public AmendmentsViewModel GetAmendmentsViewModel(int projectVersionId, string tipYear) { var result = new AmendmentsViewModel(); // get project summary info result.InfoModel = GetProjectInfo(projectVersionId, tipYear); result.ProjectSummary = GetProjectSummary(projectVersionId); TIPSearchModel search = new TIPSearchModel() { ProjectId = (Int32)result.ProjectSummary.ProjectId , TipYearID = GetYearId(tipYear, Enums.TimePeriodType.TimePeriod) }; result.AmendmentList = GetProjectAmendments(search); result.ProjectAmendments = result.AmendmentList.FirstOrDefault() ?? new ProjectAmendments(); //result.ProjectAmendments.ProjectVersionId = projectVersionId; var allowedTypes = new List<Enums.AmendmentType>(); allowedTypes.Add(Enums.AmendmentType.Administrative); allowedTypes.Add(Enums.AmendmentType.Policy); result.AmendmentTypes = new Dictionary<int, string>(); foreach (Enums.AmendmentType type in allowedTypes) { result.AmendmentTypes.Add((int)type, StringEnum.GetStringValue(type)); } return result; }
public ActionResult Amend(AmendmentsViewModel amendmentViewModel) { /* Get Current Amendment Status * Does project need to be copied? * Amend Project * Check if Previous Active Amendment needs to be changed to inactive * Return to details page */ ProjectAmendments amendment = amendmentViewModel.ProjectAmendments; //amendment.LocationMapPath = DRCOGConfig.GetConfig().LocationMapPath; //IAmendmentStrategy strategy = new AmendmentStrategy(_projectRepository, amendment).PickStrategy(); int projectVersionId = Amend(amendment); return RedirectToAction("Funding", new { controller = "Project", id = projectVersionId, message = "Amendment created successfully." }); }