Beispiel #1
0
        public Common.DTO.SpecialtiesAndCount GetSpecialtiesByDirectionAndDistrict(DirectionAndDistrictInfo directionAndDistrictinfo)
        {
            Common.DTO.SpecialtiesAndCount specialtiesAndCount;

            if (directionAndDistrictinfo.District == 0)
            {
                specialtiesAndCount = this.GetSpecialtiesByDirection(directionAndDistrictinfo);
            }
            else
            {
                specialtiesAndCount = this.GetSpecialtiesByDirectionAndDistrictAll(directionAndDistrictinfo);
            }

            return(specialtiesAndCount);
        }
 public SpecialtiesAndCount GetSpecialtiesByDirectionAndDistrict([FromBody] DirectionAndDistrictInfo directionAndDistrictInfo) => this.specialtyProvider.GetSpecialtiesByDirectionAndDistrict(directionAndDistrictInfo);
Beispiel #3
0
        public Common.DTO.SpecialtiesAndCount GetSpecialtiesByDirectionAndDistrictAll(DirectionAndDistrictInfo directionAndDistrict)
        {
            Common.DTO.SpecialtiesAndCount specialtiesAndCount = new Common.DTO.SpecialtiesAndCount();

            var qry = from s in this.context.Specialties
                      where s.Direction.GeneralDirection.Id == directionAndDistrict.GeneralDirection
                      join u in this.context.Universities on s.University.Id equals u.Id
                      join d in this.context.Districts on u.District.Id equals d.Id
                      where d.Id == directionAndDistrict.District
                      orderby RatingProvider.GetRating(s.NumApplication, s.NumEnrolled) descending
                      select new Common.DTO.Specialty()
            {
                Name       = s.Name,
                Address    = u.Address,
                District   = d.Name,
                Site       = u.Site,
                University = u.Name,
                Subjects   = (from ss in this.context.Specialty_Subjects
                              where ss.Specialty.Id == s.Id
                              select ss.Subject.ToCommon()).ToList()
            };

            specialtiesAndCount.CountOfAllElements = qry.Count();
            specialtiesAndCount.ListSpecialties    = qry.Skip((directionAndDistrict.Page - 1) * directionAndDistrict.CountOfElementsOnPage).Take(directionAndDistrict.CountOfElementsOnPage);
            return(specialtiesAndCount);
        }