public void Save(CentreTypeViewModel assetTypeViewModel)
 {
     CentreType centreType = new CentreType(assetTypeViewModel.Id)
     {
         Name = assetTypeViewModel.Name,
         Description = assetTypeViewModel.Description,
         Code = assetTypeViewModel.Code
     };
     _centreTypeRepository.Save(centreType);
 }
예제 #2
0
 public ActionResult EditCentreType(CentreTypeViewModel atvm)
   {
       try
       {
           _centreTypeViewModelBuilder.Save(atvm);
           TempData["msg"] = "Centre Type Successfully Edited";
           return RedirectToAction("ListCentreTypes");
       }
       catch (DomainValidationException dve)
       {
           ValidationSummary.DomainValidationErrors(dve, ModelState);
           return View();
       }
       catch (Exception ex)
       {
           _log.Debug("Failed to edit Centre type" + ex.Message);
           _log.Error("Failed to edit Centre type" + ex.ToString());
           return View();
       }
   }
예제 #3
0
        public ActionResult CreateCentreType(CentreTypeViewModel atvm)
        {
            try
            {
                atvm.Id = Guid.NewGuid();
                _centreTypeViewModelBuilder.Save(atvm);
                TempData["msg"] = "Centre Type Successfully Created";
                return RedirectToAction("ListCentreTypes");
            }
            catch (DomainValidationException dve)
            {
                ValidationSummary.DomainValidationErrors(dve, ModelState);
                return View();
            }
            catch (Exception ex)
            {
                ViewBag.msg = ex.Message;
                return View();
            }

        }