public async Task <IActionResult> Create([Bind("Number,RoomTypeID,Price,Available,Description,MaximumGuests")] Room room, string[] SelectedFeatureIDs) { if (ModelState.IsValid) { room.ID = Guid.NewGuid().ToString(); await _hotelService.CreateItemAsync(room); _hotelService.UpdateRoomFeaturesList(room, SelectedFeatureIDs); return(RedirectToAction(nameof(Index))); } _hotelService.PopulateSelectedFeaturesForRoom(room); return(View(room)); }
public async Task <IActionResult> Create([Bind("Number,RoomTypeID,Price,Available,Description,MaximumGuests")] Room room, string[] SelectedFeatureIDs, string[] imageIDs) { if (ModelState.IsValid) { room.ID = Guid.NewGuid().ToString(); await _RoomService.CreateItemAsync(room); _RoomService.UpdateRoomFeaturesList(room, SelectedFeatureIDs); _RoomService.UpdateRoomImagesList(room, imageIDs); return(RedirectToAction(nameof(Index))); } ViewData["Features"] = _RoomService.PopulateSelectedFeaturesForRoom(room); var ImagesAndFeatures = await _RoomService.GetRoomFeaturesAndImagesAsync(room); ViewData["Images"] = ImagesAndFeatures.Images; return(View(room)); }