public ActionResult EditPath(PathViewModel model) { try { var rt = new RouteDTO { RouteName = model.RouteName, Distance = model.Distance, }; rs.EditPath(rt, model.OldName); Unit.Save(); Unit.Dispose(); var data = rs.RouteScaf().Select(p => new PathViewModel { RouteName = p.RouteName, Distance = p.Distance }).ToList(); return(RedirectToAction("CreatePath")); } catch (Exception ex) { return(View(ex.Message)); } }