public ActionResult Edit(EditViewModel vmEdit) { try { if (!ModelState.IsValid) { return(RedirectToAction("Index", "AssetType")); } // transfer vm to bm var bmAssetType = new Business.Models.AccountType() { AssetTypeId = vmEdit.Id, AssetTypeName = vmEdit.Name, }; // update db var message = _assetTypeService.EditPostUpdateDatabase(bmAssetType); if (message != "Success") { TempData["ErrorMessage"] = message; return(RedirectToAction("Index", "AssetType")); } TempData["SuccessMessage"] = "Record updated."; return(RedirectToAction("Index", "AssetType")); } catch (Exception) { TempData["ErrorMessage"] = "Encountered problem"; return(RedirectToAction("Index", "AssetType")); } }
public CreateLinkedSettingTypesViewModel(Business.Models.AccountType bmAssetType, List <Business.Models.AttributeType> bmSettingTypes) { AssetTypeId = bmAssetType.AssetTypeId; AssetTypeName = bmAssetType.AssetTypeName; SettingTypes = bmSettingTypes; }
public IndexLinkedSettingTypesViewModel(Business.Models.AccountType bmAssetType) { Id = bmAssetType.AssetTypeSettingTypeId; //AssetTypeId = dtoAssetTypeSettingType.AssetTypeId; //IsActive = dtoAssetTypeSettingType.IsActive; AssetTypeId = bmAssetType.AssetTypeId; AssetTypeName = bmAssetType.AssetTypeName; //SettingTypeIsActive = dtoSettingType.IsActive; }
public string EditPostUpdateDatabase(Business.Models.AccountType bmAssetType) { // get dto var dtoAssetType = _unitOfWork.AssetTypes.Get(bmAssetType.AssetTypeId); if (dtoAssetType == null) { return("Invalid Asset Type"); } // transfer bm to dto dtoAssetType.Name = bmAssetType.AssetTypeName; // update db _unitOfWork.CommitTrans(); return("Success"); }
public EditLinkedSettingTypesViewModel(Business.Models.AccountType bmAssetType) { AssetTypeId = bmAssetType.AssetTypeId; AssetTypeName = bmAssetType.AssetTypeName; }
public DetailsViewModel(Business.Models.AccountType bmAssetType) { Id = bmAssetType.AssetTypeId; Name = bmAssetType.AssetTypeName; }
public EditViewModel(Business.Models.AccountType bmAssetType) { Id = bmAssetType.AssetTypeId; Name = bmAssetType.AssetTypeName; //IsActive = dtoAssetType.IsActive; }