-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParentResourceAppointment.cs
More file actions
18 lines (15 loc) · 935 Bytes
/
ParentResourceAppointment.cs
File metadata and controls
18 lines (15 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class ParentResourceAppointment : Wrapper<Appointment>
{
private ParentResourceAppointment(ResourceAppointment resourceAppt, Guid parentResourceId) : base(resourceAppt.Entity)
{
if (resourceAppt.SelectedAppointmentResources.All(r => r.Resource.Id != parentResourceId))
throw new Exception($"At least one resource must have Id {parentResourceId}");
}
public IReadOnlyCollection<SelectedAppointmentResource> SelectedAppointmentResources => Entity.SelectedAppointmentResources;
public DateTime BookedStart => Entity.BookedStart;
public DateTime BookedEnd => Entity.BookedEnd;
public static ParentResourceAppointment From(ResourceAppointment resourceAppt, Guid parentResourceId)
=> new ParentResourceAppointment(resourceAppt, parentResourceId);
public ResourceAppointment AsResourceAppointment()
=> ResourceAppointment.From(LocationAppointment.From(Entity));
}