Пример #1
0
        public ActionResult CreateRoute(AdminRouteViewModel adminRouteViewModel)
        {
            ViewBag.DistributorList = _adminRouteViewModelBuilder.Distributor();        


            try
            {
                adminRouteViewModel.Id = Guid.NewGuid();
                _adminRouteViewModelBuilder.Save(adminRouteViewModel);
             
                return RedirectToAction("listroutes");
            }
            catch (DomainValidationException ve)
            {
                ValidationSummary.DomainValidationErrors(ve, ModelState);
                return View();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return View();
            }


        }
Пример #2
0
 public ActionResult CreateRoute(AdminRouteViewModel adminRouteViewModel)
 {
  
     try
     {
         adminRouteViewModel.Id = Guid.NewGuid();
         _adminRouteViewModelBuilder.Save(adminRouteViewModel);
         TempData["msg"] = "Route Successfully Created";
         return RedirectToAction("listroutes");
     }
     catch (DomainValidationException ve)
     {
         ValidationSummary.DomainValidationErrors(ve, ModelState);
         ViewBag.DistributorList = _adminRouteViewModelBuilder.Distributor();
         ViewBag.RegionList = _adminRouteViewModelBuilder.Regions();
         return View();
     }
     catch (Exception ex)
     {
         ViewBag.DistributorList = _adminRouteViewModelBuilder.Distributor();
         ViewBag.RegionList = _adminRouteViewModelBuilder.Regions();
         ModelState.AddModelError("", ex.Message);
        
     }
     return View();
 }
Пример #3
0
        public ActionResult EditRoute(AdminRouteViewModel vm)
        {
            ViewBag.DistributorList = _adminRouteViewModelBuilder.Distributor();

            try
            {
                _adminRouteViewModelBuilder.Save(vm);
                TempData["msg"] = "Route Successfully Edited";
                return RedirectToAction("listroutes");
            }
            catch (DomainValidationException ve)
            {

                ValidationSummary.DomainValidationErrors(ve, ModelState);
                return View();

            }
            catch (Exception ex)
            {
               //Session["msg"] = ex.Message;
                ModelState.AddModelError("", ex.Message);
            }
            ViewBag.DistributorList = _adminRouteViewModelBuilder.Distributor();
            ViewBag.RegionList = _adminRouteViewModelBuilder.Regions();
            return View();
        }