Beispiel #1
0
        public ActionResult Edit(Company model)
        {
            if (ModelState.IsValid)
            {
                var handler = new CompanyHandler();
                var success = handler.Update(model.Id, model);

                if (success)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            else
            {
                return(View(model));
            }
        }
Beispiel #2
0
        public HttpResponseMessage Update(int id, Company model)
        {
            var handler = new CompanyHandler();

            try
            {
                var success = handler.Update(id, model);

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