Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            _business.Delete(id);

            return(RedirectToAction("Index"));
        }