Example #1
0
        public PartialViewResult EditProjectGrantAllocationRequestsForProject(ProjectPrimaryKey projectPrimaryKey)
        {
            var   project = projectPrimaryKey.EntityObject;
            var   currentProjectGrantAllocationRequests = project.ProjectGrantAllocationRequests.ToList();
            Money projectEstimatedTotalCost             = project.EstimatedTotalCost.GetValueOrDefault();

            var viewModel = new EditProjectGrantAllocationRequestsViewModel(project.ProjectID, currentProjectGrantAllocationRequests, true, projectEstimatedTotalCost, project.ProjectFundingSourceNotes, project.ProjectFundingSources.ToList());

            return(ViewEditProjectGrantAllocationRequests(project, viewModel));
        }
Example #2
0
        private static ActionResult UpdateProjectGrantAllocationRequests(EditProjectGrantAllocationRequestsViewModel viewModel,
                                                                         List <ProjectGrantAllocationRequest> currentProjectGrantAllocationRequests,
                                                                         Project project)
        {
            HttpRequestStorage.DatabaseEntities.ProjectGrantAllocationRequests.Load();
            var allProjectGrantAllocationRequests = HttpRequestStorage.DatabaseEntities.ProjectGrantAllocationRequests.Local;

            HttpRequestStorage.DatabaseEntities.ProjectFundingSources.Load();
            var allProjectFundingSources     = HttpRequestStorage.DatabaseEntities.ProjectFundingSources.Local;
            var currentProjectFundingSources = project.ProjectFundingSources.ToList();

            viewModel.UpdateModel(currentProjectGrantAllocationRequests, allProjectGrantAllocationRequests, project, currentProjectFundingSources, allProjectFundingSources);

            return(new ModalDialogFormJsonResult());
        }
Example #3
0
        private PartialViewResult ViewEditProjectGrantAllocationRequests(Project project, EditProjectGrantAllocationRequestsViewModel viewModel)
        {
            var allGrantAllocations = HttpRequestStorage.DatabaseEntities.GrantAllocations.ToList().Select(x => new GrantAllocationSimple(x)).OrderBy(p => p.DisplayName).ToList();
            var viewData            = new EditProjectGrantAllocationRequestsViewData(new ProjectSimple(project), allGrantAllocations);

            return(RazorPartialView <EditProjectGrantAllocationRequests, EditProjectGrantAllocationRequestsViewData, EditProjectGrantAllocationRequestsViewModel>(viewData, viewModel));
        }
Example #4
0
        public ActionResult EditProjectGrantAllocationRequestsForProject(ProjectPrimaryKey projectPrimaryKey, EditProjectGrantAllocationRequestsViewModel viewModel)
        {
            var project = projectPrimaryKey.EntityObject;
            var currentProjectGrantAllocationRequests = project.ProjectGrantAllocationRequests.ToList();

            if (!ModelState.IsValid)
            {
                return(ViewEditProjectGrantAllocationRequests(project, viewModel));
            }
            return(UpdateProjectGrantAllocationRequests(viewModel, currentProjectGrantAllocationRequests, project));
        }