public ActionResult Delete(int id) { var complaint = _complaintService.GetbyId(id); _complaintService.Delete(complaint); return(RedirectToAction("Index")); }
// DELETE api/Complaint/5 public IHttpActionResult Delete(int id) { complaintService = new ComplaintService(); var response = complaintService.Delete(id); if (response.Success) { return(Ok(id)); } return(Content(HttpStatusCode.BadRequest, response.Message)); }
public IActionResult Delete(ComplaintModel model) { try { if (ModelState.IsValid) { _service.Delete(model.Id); return(Ok()); } return(BadRequest(ModelState)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult Delete(int id) { _complaintService.Delete(id); return(Ok(new { message = "Complaint Deleted Successfully." })); }