public static BookingRoomModel MapBookingRoomToBookingRoomModel(BookingRoom bookingRoom, BookingModel @ref, RoomModel room) { var BookingRoom = new BookingRoomModel { Id = bookingRoom.Id, BookingId = bookingRoom.BookingId, BookingModel = @ref, RoomId = bookingRoom.RoomId, Room = room }; BookingRoom.ExtraFacilities = bookingRoom.ExtraFacilities?.Select(ef => FacilityMappings.MapExtraFacilityToEFModel(ef, BookingRoom, FacilityMappings.MapFacilityToFacilityModel(ef.Facility))).ToList(); return(BookingRoom); }
public static Room MapRoomModelToRom(RoomModel rmodel) { var Room = new Room { Id = rmodel.Id, Enabled = rmodel.Active, Occupied = rmodel.Occupied, NrOfGuests = rmodel.GuestsNr, Price = rmodel.Price, Name = rmodel.RoomName, CategoryId = rmodel.CategoryId, Description = rmodel.RoomDescription, ImageUrl = rmodel.ImagePath }; Room.RoomFacilities = rmodel.RoomFacilities.Select(rf => FacilityMappings. MapRfModelToRoomFacility(rf, Room, FacilityMappings.MapFacilityModelToFacility(rf.Facility))).ToList(); return(Room); }
public static RoomModel MapRoomToRoomModel(Room room, RoomCategoryModel CatModel) { var roomModel = new RoomModel { Id = room.Id, Active = room.Enabled, Occupied = room.Occupied, GuestsNr = room.NrOfGuests, Price = room.Price, RoomName = room.Name, CategoryId = room.CategoryId, RoomCategory = CatModel, RoomDescription = room.Description }; roomModel.BookingRooms = room.BookingRooms.Select(b => BookingMappings.MapBookingRoomToBookingRoomModel(b, null, null)).ToList(); roomModel.RoomFacilities = room.RoomFacilities.Select(rf => FacilityMappings. MapRoomFacilityToRFModel(rf, roomModel, FacilityMappings.MapFacilityToFacilityModel(rf.Facility))).ToList(); return(roomModel); }