yavsc/Yavsc/Model/Booking/BookQuery.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2016-05-17 18:22:18 +02:00
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2016-06-14 03:37:57 +02:00
using Yavsc.Models.Billing;
2016-05-17 18:22:18 +02:00
namespace Yavsc.Models.Booking
{
/// <summary>
/// Query, for a date, with a given perfomer, at this given place.
/// </summary>
2016-06-14 03:37:57 +02:00
public class BookQuery : NominativeServiceCommand {
/// <summary>
/// The command identifier
/// </summary>
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id {get; set; }
2016-07-27 13:06:00 +02:00
[Display(Name="Event date")]
2016-09-05 19:01:43 +02:00
public DateTime EventDate{
get
{ return ((RendezVous)Bill[0]).EventDate; }
set { ((RendezVous)Bill[0]).EventDate = value; }
}
public Location Location {
get
{ return ((RendezVous)Bill[0]).Location; }
set { ((RendezVous)Bill[0]).Location = value; }}
2016-05-17 18:22:18 +02:00
2016-06-14 03:37:57 +02:00
public BookQuery()
{
2016-09-05 19:01:43 +02:00
this.Bill.Add(new RendezVous());
2016-06-14 03:37:57 +02:00
}
public BookQuery(Location eventLocation, DateTime eventDate)
{
2016-09-05 19:01:43 +02:00
this.Bill.Add(new RendezVous{
Location = eventLocation,
EventDate = eventDate
});
2016-06-14 03:37:57 +02:00
}
2016-09-05 00:25:29 +02:00
public string GetDescription() {
return $"{Location?.Address} {EventDate.ToString()}";
}
2016-05-17 18:22:18 +02:00
}
}