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)); }
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()); }
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)); }
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)); }