public ActionResult Edit(int id, FormCollection collection) { if (!Access.HasAccess(8)) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "Home", route)); } try { // TODO: Add update logic here Branche theBranche = new Branche(); theBranche = theBranche.GetById(id); theBranche.FullName = collection["FullName"]; theBranche.ShortName = collection["ShortName"]; theBranche.Update(theBranche); return(RedirectToAction("Index")); } catch (Exception ex) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", ex.Message); return(RedirectToAction("Error", "Home", route)); } }