public void Save(TerritoryViewModel territory)
  {
      Territory terr = new Territory(territory.Id) 
      {
       Name=territory.Name
      };
      _territoryRepository.Save(terr);
  }
示例#2
0
        public ActionResult CreateTerritory(TerritoryViewModel territory)
        {
            try
            {
                _territoryViewModelBuilder.Save(territory);

                return RedirectToAction("ListTerritory");
            }
            catch (DomainValidationException dve)
            {
                ValidationSummary.DomainValidationErrors(dve, ModelState);
                return View();
            }
            catch(Exception exx)
            {
                ViewBag.msg = exx.Message;
                return View();
            }
        }
 public ActionResult EditTerritory(TerritoryViewModel territory)
 {
     try
     {
         _territoryViewModelBuilder.Save(territory);
         _auditLogViewModelBuilder.AddAuditLog(this.User.Identity.Name, "Edit", "Country Region", DateTime.Now);
         TempData["msg"] = "Country Region Successfully Edited";
         return RedirectToAction("ListTerritory");
     }
     catch (DomainValidationException dve)
     {
         ValidationSummary.DomainValidationErrors(dve, ModelState);
         _log.Debug("Failed to edit country region" + dve.Message);
         _log.Error("Failed to edit country region" + dve.ToString());
         return View();
     }
     catch(Exception exx)
     {
         ViewBag.msg = exx.Message;
         _log.Debug("Failed to edit country region" + exx.Message);
         _log.Error("Failed to edit country region" + exx.ToString());
         return View();
     }
 }