public ActionResult EditProjectFundingSourceBudgetByCostTypeForProject(ProjectPrimaryKey projectPrimaryKey, EditProjectFundingSourceBudgetByCostTypeViewModel viewModel) { var project = projectPrimaryKey.EntityObject; var calendarYearRange = project.CalculateCalendarYearRangeForBudgetsWithoutAccountingForExistingYears(); if (!ModelState.IsValid) { return(ViewEditProjectFundingSourceBudgetByCostType(project, calendarYearRange, viewModel)); } viewModel.UpdateModel(project, HttpRequestStorage.DatabaseEntities); return(new ModalDialogFormJsonResult()); }
public ActionResult EditProjectFundingSourceBudgetByCostTypeForProject(ProjectPrimaryKey projectPrimaryKey, EditProjectFundingSourceBudgetByCostTypeViewModel viewModel) { var project = projectPrimaryKey.EntityObject; if (!ModelState.IsValid) { var calendarYearRange = project.CalculateCalendarYearRangeForBudgetsWithoutAccountingForExistingYears(); return(ViewEditProjectFundingSourceBudgetByCostType(project, calendarYearRange, viewModel)); } // if user pressed save button, save their changes before returning them to the project detail page if (viewModel.ShouldSaveChanges) { viewModel.UpdateModel(project, HttpRequestStorage.DatabaseEntities); SetMessageForDisplay($"Projected Funding updated for {project.ProjectName}."); } return(Redirect(project.GetDetailUrl() + "#financials-1")); }