public IActionResult Delete(int id) { return(Ok(new List <Hotel>() { service.Delete(id) })); }
// DELETE: api/Employees/5 public IHttpActionResult DeleteHotel(int hotelId) { //Hotel remove_hotel = db.Hotels.Find(hotelId); Hotel remove_hotel = _hotelService.Queryable().Where(c => c.Id == hotelId).FirstOrDefault(); //bool remove_hotel_result = _hotelService.Delete(remove_hotel.Id); if (remove_hotel == null) { return(NotFound()); } //db.Hotels.Remove(remove_hotel); //try //{ // // db.SaveChanges(); //} //catch (DbUpdateConcurrencyException ex) //{ // return BadRequest(ex.Message); //} return(Ok(remove_hotel)); }
public IActionResult DeleteHotel(long id) { var result = hotelService.Delete(id); if (result == null) { return(NotFound()); } return(Ok(result)); }
public IActionResult DeleteHotel(Hotel hotel) { var result = _hotelService.Delete(hotel); if (result.Success) { return(Ok(result)); } return(BadRequest(result.Message)); }
public IActionResult Delete(string id) { var hotelIdDecrypted = Decrypt.DecryptToInt32(id); if (hotelIdDecrypted != 0) { var response = _hotelService.Delete(hotelIdDecrypted); return(Ok(response)); } return(Ok(BaseResponse <bool> .BadRequest())); }
public IActionResult Delete(int id) { var hotel = _hotelService.FindHotel(id); var currentUserId = int.Parse(User.Identity.Name); if (currentUserId != hotel.User.Id && !User.IsInRole("Admin")) { return(Forbid()); } _hotelService.Delete(id); return(Ok()); }
public IActionResult DeleteHotel(int id) { try { _hotelService.Delete(id); return(Ok()); } catch (Exception e) { _logger.LogInformation(e.Message, e.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public async Task <ActionResult> Delete(long id, IFormCollection collection) { try { await hotelService.Delete(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Delete(HotelDTO hotel, int?id) { string error = ""; // hotelRepository.ValidateDelete(hotel); ReturnUrlSet(); if (error.Length == 0) { hotel = hotelService.GetHotel(hotel.Id); hotelService.Delete(hotel); return(View("Success", (object)"Hotel deleted successfully.")); } else { return(Redirect((string)TempData["ReturnUrl"])); } }
public ActionResult Delete(Guid id) { try { _service.Delete(id); return(Ok()); } catch (Exception e) { string errors = e.Message; return(ValidationProblem(new ValidationProblemDetails() { Type = "Cannot delete", Detail = errors })); } }
public ActionResult <Hotel> Delete(int id) { return(_hotelService.Delete(id)); }
public ActionResult Delete(int id) { service.Delete(id); return(Json(new { message = "Borrado Con Exito" })); }
public async Task <ActionResult> DeleteHotel(int id) { await _hotelService.Delete(id); return(Ok()); }
public async Task <IActionResult> Delete(int id) { await hotelService.Delete(id); return(RedirectToAction(nameof(HomeController.Index), "Home")); }
public IActionResult Delete(Guid hotelId) { _hotelService.Delete(hotelId); return(RedirectToAction(nameof(Index))); }
public IActionResult Remove(Guid hotelId) { _hotelService.Delete(hotelId); return(Ok()); }
public IActionResult Delete([FromQuery] int id) { var res = _hotelService.Delete(id); return(Ok(res)); }
public ActionResult Delete(int?id) { _ihotelservice.Delete(id); return(RedirectToAction("Index")); }