Exemplo n.º 1
0
        private async Task <SourceEmployer> AddSourceEmployerAsync(SourceType sourceType,
                                                                   HeadHunterEmployer headHunterEmployer)
        {
            var employer = _storageBroker.SelectAllEmployers()
                           .FirstOrDefault(item =>
                                           item.Name.ToLower().Equals(headHunterEmployer.Name.ToLower())) ??
                           await AddEmployerAsync(headHunterEmployer);

            var sourceEmployer = new SourceEmployer
            {
                SourceId     = headHunterEmployer.Id,
                EmployerId   = employer.Id,
                SourceTypeId = sourceType.Id,
                Url          = headHunterEmployer.Url
            };

            sourceEmployer = await _storageBroker.InsertSourceEmployerAsync(sourceEmployer);

            return(sourceEmployer);
        }