public ActionResult ProjectResearcherList(int projectId) { var data = _projectResearcherService.GetProjectResearcherByProjectId(projectId).ToList(); var model = new ProjectResearcherListModel(); model.Data = data; model.Total = data.Count; model.Errors = ""; return(Json(model)); }
public ProjectModel() { AvailableProjectStatuses = new List <SelectListItem>(); AvailableProfessors = new List <SelectListItem>(); AvailableResearchIssues = new List <SelectListItem>(); AvailableStrategyGroups = new List <SelectListItem>(); AvailableProfessorTypes = new List <SelectListItem>(); AvailableResearchers = new List <SelectListItem>(); AvailableProjectRoles = new List <SelectListItem>(); ProjectResearcherSearchModel = new ProjectResearcherSearchModel(); ProjectProfessorSearchModel = new ProjectProfessorSearchModel(); ProjectProgressSearchModel = new ProjectProgressSearchModel(); AvailableProgressStatuses = new List <SelectListItem>(); ProjectResearcherListModel = new ProjectResearcherListModel(); ProjectProfessorListModel = new ProjectProfessorListModel(); }
public ProjectResearcherListModel PrepareProjectResearcherListModel(ProjectResearcherSearchModel searchModel, Project project) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (project == null) { throw new ArgumentNullException(nameof(project)); } //get researcher educations //chai //var researcherEducations = researcher.ResearcherEducations.OrderByDescending(edu => edu.Degree).ToList(); var projectResearchers = _projectService.GetAllProjectResearchers(project.Id).ToList(); //prepare list model var model = new ProjectResearcherListModel { Data = projectResearchers.PaginationByRequestModel(searchModel).Select(x => { //fill in model values from the entity var projectResearcherModel = new ProjectResearcherModel { Id = x.Id, Portion = x.Portion, ProjectId = x.ProjectId, RoleName = (int)x.ProjectRole != 0 ? x.ProjectRole.GetAttributeOfType <EnumMemberAttribute>().Value : string.Empty, ResearcherId = x.ResearcherId, ProjectRoleId = x.ProjectRoleId, ResearcherName = x.ResearcherName, }; return(projectResearcherModel); }), Total = projectResearchers.Count }; return(model); }