Exemplo n.º 1
0
        public Task <PagedItems <SubscriptionVacancy> > GetSubscriptionVacanciesAsync(int subscriptionId,
                                                                                      GetAllSubscriptionVacanciesFilter filter = null,
                                                                                      PaginationFilter paginationFilter        = null, SortByOptions sortByOptions = null)
        {
            return(TryCatch(async() =>
            {
                var subscription = await _storageBroker.SelectSourceSubscriptionByIdAsync(subscriptionId);
                ValidateSubscription(subscription, subscriptionId);
                var queryable = _storageBroker.SelectAllSubscriptionVacancies();

                queryable = ApplySorting(sortByOptions, queryable).IncludeAllProperties()
                            .Where(sv => sv.SourceSubscriptionId == subscriptionId);
                queryable = AddFiltersOnQuery(filter, queryable);

                if (paginationFilter == null)
                {
                    return await queryable.ToPagedItemsAsync();
                }

                return await queryable.ToPagedItemsAsync(paginationFilter.PageNumber, paginationFilter.PageSize);
            }));
        }
Exemplo n.º 2
0
 public async Task <List <Employer> > GetEmployersBySubscriptionIdAsync(int subscriptionId)
 {
     return(await _storageBroker
            .SelectAllSubscriptionVacancies()
            .Where(sv => sv.SourceSubscriptionId == subscriptionId)
            .Select(sv =>
                    new Employer
     {
         Id = sv.Vacancy.Employer.Id,
         Name = sv.Vacancy.Employer.Name
     }
                    )
            .Distinct()
            .ToListAsync());
 }
Exemplo n.º 3
0
 public async Task <List <Schedule> > GetSchedulesBySubscriptionIdAsync(int subscriptionId)
 {
     return(await _storageBroker
            .SelectAllSubscriptionVacancies()
            .Where(sv => sv.SourceSubscriptionId == subscriptionId &&
                   sv.Vacancy.ScheduleId != null)
            .Select(sv =>
                    new Schedule
     {
         Id = sv.Vacancy.Schedule.Id,
         Name = sv.Vacancy.Schedule.Name
     }
                    )
            .Distinct()
            .ToListAsync());
 }
Exemplo n.º 4
0
 public Task <List <Area> > GetAreasBySubscriptionIdAsync(int subscriptionId)
 {
     return(TryCatch(async() =>
     {
         return await _storageBroker
         .SelectAllSubscriptionVacancies()
         .Where(sv => sv.SourceSubscriptionId == subscriptionId &&
                sv.Vacancy.AreaId != null)
         .Select(sv =>
                 new Area
         {
             Id = sv.Vacancy.Area.Id,
             Name = sv.Vacancy.Area.Name
         })
         .Distinct()
         .ToListAsync();
     }));
 }
Exemplo n.º 5
0
        public Task <IList <Skill> > GetAllSkills(GetAllSkillsFilter filter = null)
        {
            return(TryCatch(async() =>
            {
                if (filter?.SubscriptionId == null)
                {
                    var queryable = _storageBroker.SelectAllSkills();
                    queryable = AddFiltersOnQuery(filter, queryable);
                    return await queryable.ToListAsync();
                }

                //check subscriptionId
                var subscription = await _storageBroker.SelectSourceSubscriptionByIdAsync(filter.SubscriptionId.Value);
                ValidateSubscription(subscription, filter.SubscriptionId.Value);

                var queryableBySubscription = _storageBroker.SelectAllSubscriptionVacancies();
                var query = AddFiltersWithSubscriptionOnQuery(filter, queryableBySubscription);

                return await query.ToListAsync();
            }));
        }