public void Save(CentreTypeViewModel assetTypeViewModel)
 {
     CentreType centreType = new CentreType(assetTypeViewModel.Id)
     {
         Name = assetTypeViewModel.Name,
         Description = assetTypeViewModel.Description,
         Code = assetTypeViewModel.Code
     };
     _centreTypeRepository.Save(centreType);
 }
 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();
       }
   }
        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();
            }

        }