Esempio n. 1
0
        // GET: Hotels/Delete/5
        public async Task <IActionResult> Delete(int id)
        {
            if (id <= 0)
            {
                return(NotFound());
            }

            await _context.DeleteHotel(id);

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var hotel = await _context.GetHotel(id);

            _context.DeleteHotel(hotel);
            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 3
0
        // GET: Hotels/Delete/5
        public async Task <IActionResult> Delete(int id)
        {
            Hotel hotel = await _context.DeleteHotel(id);



            return(View(hotel));
        }
Esempio n. 4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var hotel = await _hotels.GetHotel(id);

            if (hotel != null)
            {
                _hotels.DeleteHotel(hotel);
            }
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> DeleteHotel([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _hotel.DeleteHotel(id);

            return(Ok());
        }
Esempio n. 6
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            /*
             * var hotel = await _context.Hotels.FindAsync(id);
             * _context.Hotels.Remove(hotel);
             * await _context.SaveChangesAsync();
             * return RedirectToAction(nameof(Index));
             */
            await _context.DeleteHotel(id);

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <ActionResult <HotelDto> > DeleteHotel(int id)
        {
            var hotelDto = await _hotel.GetHotel(id);

            if (hotelDto == null)
            {
                return(NotFound());
            }

            await _hotel.DeleteHotel(id);

            return(hotelDto);
        }
Esempio n. 8
0
 public async Task <IActionResult> DeleteConfirmed(int id)
 {
     _context.DeleteHotel(id);
     return(RedirectToAction(nameof(Index)));
 }
Esempio n. 9
0
 // DELETE api/Hotel/Delete/5
 public IHttpActionResult Delete(int id)
 {
     _hotelManager.DeleteHotel(id);
     return(Ok());
 }