Exemplo n.º 1
0
        public ActionResult Delete(int id, FormCollection form)
        {
            var handler = new CompanyHandler();
            var success = handler.Delete(id);

            if (success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Exemplo n.º 2
0
        public HttpResponseMessage Delete(int id)
        {
            var handler = new CompanyHandler();

            try
            {
                var success = handler.Delete(id);

                if (success)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }