public ActionResult Add(Guid projectGuid) { ProjectModificationViewModel projectModificationModel = new ProjectModificationViewModel(); try { projectModificationModel.ProjectGuid = projectGuid; projectModificationModel.ContractGuid = projectGuid; projectModificationModel.ContractNumber = _contractService.GetDetailsForProjectByContractId(projectModificationModel.ContractGuid ?? Guid.Empty).ContractNumber; projectModificationModel.ProjectNumber = _contractService.GetDetailById(projectGuid).BasicContractInfo.ProjectNumber; return(PartialView(projectModificationModel)); } catch (Exception e) { ModelState.AddModelError("", e.Message); return(View(projectModificationModel)); } }
public ActionResult Add(Guid projectGuid) { var contractModificationModel = new ContractModificationViewModel(); try { contractModificationModel.ContractGuid = projectGuid; contractModificationModel.ContractNumber = _contractService.GetDetailsForProjectByContractId(contractModificationModel.ContractGuid).ContractNumber; contractModificationModel.ProjectNumber = _contractService.GetDetailById(projectGuid).BasicContractInfo.ProjectNumber; contractModificationModel.keyValuePairs = new Dictionary <string, string>(); var contractModification = _resourceAttributeService.GetByResource(ResourceType.ContractModification.ToString()); if (contractModification != null) { var modificationType = contractModification.FirstOrDefault(x => x.Name.ToUpper() == "MODIFICATIONTYPE"); if (modificationType != null) { var resourcevalue = _resourceAttributeValueService.GetResourceAttributeOptionsByResourceAttributeGuid(modificationType.ResourceAttributeGuid); if (resourcevalue != null) { contractModificationModel.keyValuePairs = resourcevalue.ToDictionary(x => x.Value, x => x.Name); } } } ViewBag.Resourcekey = EnumGlobal.ResourceType.TaskOrderModification.ToString(); return(PartialView(contractModificationModel)); } catch (Exception e) { ModelState.AddModelError("", e.Message); return(View(contractModificationModel)); } }