Пример #1
0
        public static OutgoingReservationGroup Parse(ReservationGroup x)
        {
            if (x == null)
            {
                return(null);
            }

            return(new OutgoingReservationGroup
            {
                Id = x.Id,
                Status = OutgoingReservationGroupStatus.Parse(x.ReservationGroupStatus),
                UserId = x.UserId,
                HotelId = x.HotelId,
                StatusDate = x.StatusDate,
                StatusGuid = x.StatusGuid,
                ReserveItems = x.ReserveItems?.Select(y => OutgoingReservationItem.Parse(y))?.ToList()
            });
        }
Пример #2
0
        public static OutgoingMinimalReservationGroupExtra Parse(ReservationGroup x)
        {
            if (x == null)
            {
                return(null);
            }

            return(new OutgoingMinimalReservationGroupExtra
            {
                Id = x.Id,
                UserId = x.UserId,
                HotelId = x.HotelId,
                HotelName = x.Hotels.Name,
                StartDate = x.ReserveItems?.Where(y => y.IsDeleted == false)?.OrderByDescending(y => y.DateReservedFor)?.FirstOrDefault()?.DateReservedFor,
                EndDate = x.ReserveItems?.Where(y => y.IsDeleted == false)?.OrderBy(y => y.DateReservedFor)?.FirstOrDefault()?.DateReservedFor,
                NumberOfItems = x.ReserveItems?.Where(y => y.IsDeleted == false)?.Count() ?? 0,
                Status = OutgoingReservationGroupStatus.Parse(x.ReservationGroupStatus),
                UsersName = x?.AspNetUsers?.FirstName + " " + x?.AspNetUsers?.LastName,
                UsersEmail = x?.AspNetUsers?.Email
            });
        }