Exemplo n.º 1
0
        public IActionResult Edit(HotelViewModel entity)
        {
            if (ModelState.IsValid)
            {
                var hotel = _mapper.Map <Hotel>(entity);

                _hotelService.Edit(hotel);

                return(RedirectToAction(nameof(GetDetailsByKey), new { hotelId = entity.Id }));
            }

            return(View(entity));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit(long id, Hotel hotel)
        {
            try
            {
                await hotelService.Edit(id, hotel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public IActionResult Update([FromForm] HotelViewModel entity)
        {
            if (ModelState.IsValid)
            {
                var hotel = _mapper.Map <Hotel>(entity);

                _hotelService.Edit(hotel);

                return(Ok());
            }

            return(StatusCode(304));
        }