Exemple #1
0
        public PartialViewResult EditProjectFundingSourceBudgetsForProject(ProjectPrimaryKey projectPrimaryKey)
        {
            var project = projectPrimaryKey.EntityObject;
            var currentProjectFundingSourceBudgets = project.ProjectFundingSourceBudgets.ToList();
            var viewModel = new EditProjectFundingSourceBudgetViewModel(project, currentProjectFundingSourceBudgets);

            return(ViewEditProjectFundingSourceBudgets(project, viewModel));
        }
Exemple #2
0
        private static ActionResult UpdateProjectFundingSourceBudgets(EditProjectFundingSourceBudgetViewModel viewModel,
                                                                      Project project,
                                                                      List <ProjectFundingSourceBudget> currentProjectFundingSourceBudgets,
                                                                      List <ProjectNoFundingSourceIdentified> currentProjectNoFundingSourceIdentifieds)
        {
            HttpRequestStorage.DatabaseEntities.ProjectFundingSourceBudgets.Load();
            var allProjectFundingSourceBudgets = HttpRequestStorage.DatabaseEntities.AllProjectFundingSourceBudgets.Local;

            HttpRequestStorage.DatabaseEntities.AllProjectNoFundingSourceIdentifieds.Load();
            var allProjectNoFundingSourceIdentifieds = HttpRequestStorage.DatabaseEntities.AllProjectNoFundingSourceIdentifieds.Local;

            viewModel.UpdateModel(project, currentProjectFundingSourceBudgets, allProjectFundingSourceBudgets, currentProjectNoFundingSourceIdentifieds, allProjectNoFundingSourceIdentifieds);

            return(new ModalDialogFormJsonResult());
        }
Exemple #3
0
        private PartialViewResult ViewEditProjectFundingSourceBudgets(Project project, EditProjectFundingSourceBudgetViewModel viewModel)
        {
            var allFundingSources = HttpRequestStorage.DatabaseEntities.FundingSources.ToList().Select(x => new FundingSourceSimple(x)).OrderBy(p => p.DisplayName).ToList();
            var fundingTypes      = FundingType.All.ToList();
            var viewData          = new EditProjectFundingSourceBudgetViewData(new ProjectSimple(project), fundingTypes, allFundingSources, project.PlanningDesignStartYear, project.CompletionYear);

            return(RazorPartialView <EditProjectFundingSourceBudget, EditProjectFundingSourceBudgetViewData, EditProjectFundingSourceBudgetViewModel>(viewData, viewModel));
        }
Exemple #4
0
        public ActionResult EditProjectFundingSourceBudgetsForProject(ProjectPrimaryKey projectPrimaryKey, EditProjectFundingSourceBudgetViewModel viewModel)
        {
            var project = projectPrimaryKey.EntityObject;
            var currentProjectFundingSourceBudgets       = project.ProjectFundingSourceBudgets.ToList();
            var currentProjectNoFundingSourceIdentifieds = project.ProjectNoFundingSourceIdentifieds.ToList();

            if (!ModelState.IsValid)
            {
                return(ViewEditProjectFundingSourceBudgets(project, viewModel));
            }
            return(UpdateProjectFundingSourceBudgets(viewModel, project, currentProjectFundingSourceBudgets, currentProjectNoFundingSourceIdentifieds));
        }