コード例 #1
0
 public void Save(CoolerViewModel coolerViewModel)
 {
     Asset cooler = new Asset(coolerViewModel.Id)
     {
         AssetType = _coolerTypeRepository.GetById(coolerViewModel.CoolerTypeId ),
         Code = coolerViewModel.Code,
         Name = coolerViewModel.Name,
         Capacity = coolerViewModel.Capacity,
         AssetNo = coolerViewModel.AssetNo,
         SerialNo = coolerViewModel.SerialNo 
     };
     _coolerRepository.Save(cooler);
 }
コード例 #2
0
        public ActionResult EditCooler(CoolerViewModel ctpvm)
        {
            try
            {
                ViewBag.CoolerTypeList = _coolerViewModelBuilder.CoolerType();

                _coolerViewModelBuilder.Save(ctpvm);
                _auditLogViewModelBuilder.AddAuditLog(this.User.Identity.Name, "Edit", "Cooler", DateTime.Now);
                TempData["msg"] = "Cooler Successfully Edited";
                return RedirectToAction("ListCoolers");
            }
            catch (DomainValidationException dve)
            {
                ValidationSummary.DomainValidationErrors(dve,ModelState);
                return View();
            }
            catch (Exception ex)
            {
                _log.Debug("Failed to edit cooler" + ex.Message);
                _log.Error("Failed to edit cooler" + ex.ToString());
                return View();
            }
        }