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 ProjectProfessorListModel PrepareProjectProfessorListModel(ProjectProfessorSearchModel 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 projectProfessors = _projectService.GetAllProjectProfessors(project.Id).ToList(); //prepare list model var model = new ProjectProfessorListModel { Data = projectProfessors.PaginationByRequestModel(searchModel).Select(x => { //fill in model values from the entity // var title = (x.Professor.Title != null) ? x.Professor.Title.TitleNameTH : string.Empty; // var fullName = (x.Professor != null) ? $"{title}{x.Professor.FirstName} {x.Professor.LastName}" : string.Empty; var projectProfessorModel = new ProjectProfessorModel { Id = x.Id, ProjectId = x.ProjectId, ProfessorId = x.ProfessorId, ProfessorTypeId = x.ProfessorTypeId, ProfessorTypeName = x.ProfessorType.GetAttributeOfType <EnumMemberAttribute>().Value, ProfessorName = x.ProfessorName, }; return(projectProfessorModel); }), Total = projectProfessors.Count }; return(model); }