Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,Name,Icon")] Feature feature)
        {
            if (id != feature.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _hotelService.EditItemAsync(feature);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_hotelService.GetItemByIdAsync(id) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(feature));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,Name,BasePrice,Description")] RoomType roomType)
        {
            if (id != roomType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _roomTypeService.EditItemAsync(roomType);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_roomTypeService.GetItemByIdAsync(id) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomType));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,Number,RoomTypeID,Price,Available,Description,MaximumGuests")] Room room, string[] SelectedFeatureIDs, string[] imageIDs)
        {
            if (id != room.ID)
            {
                return(NotFound());
            }


            if (ModelState.IsValid)
            {
                try
                {
                    await _hotelService.EditItemAsync(room);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_hotelService.GetItemByIdAsync(id) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var RoomTypes = _hotelService.GetAllRoomTypesAsync().Result;

            ViewData["RoomTypeID"] = new SelectList(RoomTypes, "ID", "ID", room.RoomTypeID);
            return(View(room));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,RoomID,DateCreated,CheckIn,CheckOut,Guests,TotalFee,Paid,Completed,ApplicationUserId,CustomerName,CustomerEmail,CustomerPhone,CustomerAddress,CustomerCity,OtherRequests")] Booking booking)
        {
            if (id != booking.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _hotelService.EditItemAsync(booking);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_hotelService.GetItemByIdAsync(id) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(booking));
        }