Пример #1
0
        public ActionResult Delete(int id)
        {
            var handler = new CompanyHandler();
            var model   = handler.Get(id);

            if (model != null)
            {
                return(View(model));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Пример #2
0
        public HttpResponseMessage Get(int id)
        {
            var handler = new CompanyHandler();

            try
            {
                var company = handler.Get(id);

                if (company != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, company));
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }