public HttpResponseMessage Delete(int id) { try { if (id <= 0) { throw new Exception("Id inválido"); } _business.Delete(id); return(Request.CreateResponse(HttpStatusCode.OK, "Deletado com sucesso")); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public ActionResult Delete(int id) { _business.Delete(id); return(RedirectToAction("Index")); }