public ActionResult DeleteLocation(long id) { try{ _locationService.DeleteLocation(id); return(Ok("Location deleted!")); }catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult DeleteLocation(Locations location) { try { locationServices.DeleteLocation(location); return(Ok()); } catch (Exception) { return(BadRequest()); } }
public async Task <IActionResult> Delete(string locationId) { var locationDel = _locationServices.GetLocation(locationId); if (await _locationServices.DeleteLocation(locationDel)) { var userMessage = new MessageVM() { CssClassName = "alert alert-success ", Title = "Thành công", Message = "Đã xóa địa điểm thành công" }; TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage); } else { var userMessage = new MessageVM() { CssClassName = "alert alert-danger", Title = "Không thành công", Message = "Đã có lỗi khi thao tác, xin mời thử lại" }; TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage); } return(RedirectToAction(actionName: "Index", controllerName: "Location")); }
public ActionResult DeleteConfirmed(string id) { service.DeleteLocation(id); return(RedirectToAction("Index")); }