Exemple #1
0
 public ActionResult PathAdd(PathViewModel model)
 {
     try {
         var rt = new RouteDTO
         {
             RouteName = model.RouteName,
             Distance  = model.Distance,
             Stops     = model.Stops.Select(s => new StationDTO {
                 StationName = s
             }).ToList()
         };
         rs.AddPath(rt);
         Unit.Save();
         Unit.Dispose();
         var data = rs.RouteScaf().Select(p => new PathViewModel {
             RouteName = p.RouteName, Distance = p.Distance
         }).ToList();
         return(PartialView(data));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }