// GET: Hotels/Delete/5 public async Task <IActionResult> Delete(int id) { if (id <= 0) { return(NotFound()); } await _context.DeleteHotel(id); return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteConfirmed(int id) { var hotel = await _context.GetHotel(id); _context.DeleteHotel(hotel); return(RedirectToAction(nameof(Index))); }
// GET: Hotels/Delete/5 public async Task <IActionResult> Delete(int id) { Hotel hotel = await _context.DeleteHotel(id); return(View(hotel)); }
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()); }
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); }
public async Task <IActionResult> DeleteConfirmed(int id) { _context.DeleteHotel(id); return(RedirectToAction(nameof(Index))); }
// DELETE api/Hotel/Delete/5 public IHttpActionResult Delete(int id) { _hotelManager.DeleteHotel(id); return(Ok()); }