Пример #1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Icon")] Feature feature)
        {
            if (ModelState.IsValid)
            {
                feature.ID = Guid.NewGuid().ToString();
                await _hotelService.CreateItemAsync(feature);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(feature));
        }
Пример #2
0
        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 _hotelService.CreateItemAsync(room);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("ID,Name,BasePrice,Description")] RoomType roomType)
        {
            if (ModelState.IsValid)
            {
                roomType.ID = Guid.NewGuid().ToString();
                await _roomTypeService.CreateItemAsync(roomType);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomType));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("ID,RoomID,DateCreated,CheckIn,CheckOut,Guests,TotalFee,Paid,Completed,ApplicationUserId,CustomerName,CustomerEmail,CustomerPhone,CustomerAddress,CustomerCity,OtherRequests")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                booking.ID = Guid.NewGuid().ToString();
                await _hotelService.CreateItemAsync(booking);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(booking));
        }
        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 _hotelService.CreateItemAsync(room);

                _hotelService.UpdateRoomFeaturesList(room, SelectedFeatureIDs);
                _hotelService.UpdateRoomImagesList(room, imageIDs);
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Features"] = _hotelService.PopulateSelectedFeaturesForRoom(room);
            var ImagesAndFeatures = await _hotelService.GetRoomFeaturesAndImagesAsync(room);

            ViewData["Images"] = ImagesAndFeatures.Images;
            return(View(room));
        }