public ResearcherModel() { AvailableTitles = new List <SelectListItem>(); AvailableAgencies = new List <SelectListItem>(); AvailableAcademicRanks = new List <SelectListItem>(); AvailablePersonalTypes = new List <SelectListItem>(); AvailableAddEducationDegrees = new List <SelectListItem>(); AvailableAddEducationEducationLevels = new List <SelectListItem>(); AvailableAddEducationInstitutes = new List <SelectListItem>(); AvailableAddEducationCountries = new List <SelectListItem>(); AddressModel = new AddressModel(); ResearcherEducationSearchModel = new ResearcherEducationSearchModel(); ResearcherEducationListModel = new ResearcherEducationListModel(); }
/// <summary> /// Prepare paged researcher education list model /// </summary> /// <param name="searchModel">Researcher education search model</param> /// <param name="researcher">Researcher</param> /// <returns>Researcher education list model</returns> public ResearcherEducationListModel PrepareResearcherEducationListModel(ResearcherEducationSearchModel searchModel, Researcher researcher) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (researcher == null) { throw new ArgumentNullException(nameof(researcher)); } //get researcher educations //chai //var researcherEducations = researcher.ResearcherEducations.OrderByDescending(edu => edu.Degree).ToList(); var researcherEducations = _researcherService.GetAllResearcherEducations(researcher.Id).ToList(); //prepare list model var model = new ResearcherEducationListModel { Data = researcherEducations.PaginationByRequestModel(searchModel).Select(education => { //fill in model values from the entity var researcherEducationModel = new ResearcherEducationModel { Id = education.Id, ResearcherId = researcher.Id, DegreeName = education.Degree.GetAttributeOfType <EnumMemberAttribute>().Value, EducationLevelName = education.EducationLevelName, InstituteName = education.InstituteName, CountryName = education.CountryName, GraduationYear = education.GraduationYear }; return(researcherEducationModel); }), Total = researcherEducations.Count }; return(model); }