public ActionResult EditAsset(FixAssetViewModel assetModel) { FixAsset assetToEdit = new FixAsset(); assetToEdit.AssetTag = assetModel.AssetTag; assetToEdit.FixAssetID = assetModel.FixAssetID; assetToEdit.SerialNumber = assetModel.SerialNumber; assetToEdit.Model = assetModel.Model; assetToEdit.Brand = assetModel.Brand; assetToEdit.AssetClassID = assetModel.AssetClassID; assetToEdit.AssetStatusID = assetModel.AssetStatusID; assetToEdit.AssetTypeID = assetModel.AssetTypeID; assetToEdit.IssuerID = assetModel.IssuerID; assetToEdit.LocationID = assetModel.LocationID; assetToEdit.Remarks = assetModel.Remarks; if (assetModel.AcquisitionDate != null) { assetToEdit.AcquisitionDate = assetModel.AcquisitionDate; } if (assetModel.ExpiryDate != null) { assetToEdit.ExpiryDate = assetModel.ExpiryDate; } AssetProcess assetProcess = new AssetProcess(); try { if (assetProcess.Update(assetToEdit) == FASTConstant.RETURN_VAL_SUCCESS) { TempData[FASTConstant.TMPDATA_RESULT] = FASTConstant.SUCCESSFUL; TempData[FASTConstant.TMPDATA_SOURCE] = "Edit Fix Asset"; TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = "The asset has been successfully modified."; TempData[FASTConstant.TMPDATA_ACTION] = "Index"; TempData[FASTConstant.TMPDATA_CONTROLLER] = "FixAsset"; return(View("~/Views/Shared/Result.cshtml")); } else { throw new Exception("There was an error while adding the new employee."); } } catch (Exception ex) { TempData[FASTConstant.TMPDATA_RESULT] = FASTConstant.FAILURE; TempData[FASTConstant.TMPDATA_SOURCE] = "Edit Fix Asset"; TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = ex.Message; return(View("~/Views/Shared/Result.cshtml")); } }