예제 #1
0
 public static ResourceDto AsDto(this ResourceDocument document)
 => new ResourceDto
 {
     Id           = document.Id,
     Reservations = document.Reservations?.Select(r => new ReservationDto
     {
         DateTime = r.TimeStamp.AsDateTime(),
         Priority = r.Priority
     })
 };
예제 #2
0
 public static ResourceDto AsDto(this ResourceDocument document)
 => new ResourceDto
 {
     Id           = document.Id,
     Tags         = document.Tags ?? Enumerable.Empty <string>(),
     Reservations = document.Reservations?.Select(r => new ReservationDto
     {
         DateTime = r.TimeStamp.AsDateTime(),
         Priority = r.Priority
     }) ?? Enumerable.Empty <ReservationDto>()
 };
예제 #3
0
 public static Resource AsEntity(this ResourceDocument document)
 => new Resource(document.Id, document.Tags, document.Reservations
                 .Select(r => new Reservation(r.TimeStamp.AsDateTime(), r.Priority)), document.Version);