Example #1
0
        public async Task <PagedItems <Vacancy> > GetVacanciesAsync(PaginationFilter paginationFilter = null)
        {
            if (paginationFilter == null)
            {
                return(await _storageBroker.SelectAllVacancies()
                       .IncludeAllProperties()
                       .ToPagedItemsAsync());
            }

            return(await _storageBroker.SelectAllVacancies()
                   .IncludeAllProperties()
                   .ToPagedItemsAsync(paginationFilter.PageNumber, paginationFilter.PageSize));
        }
Example #2
0
        public async Task UpdateArchivedAsync()
        {
            foreach (var vacancy in _storageBroker.SelectAllVacancies().Where(v => !v.IsArchived).ToList())
            {
                try
                {
                    var headHunterVacancy = await _headHunterBroker.GetVacancy(vacancy.SourceId);

                    if (headHunterVacancy.IsArchived != vacancy.IsArchived)
                    {
                        await ArchiveVacancy(vacancy);
                    }
                }
                catch (VacancyNotFound)
                {
                    await ArchiveVacancy(vacancy);
                }
            }
        }