Beispiel #1
0
        private async Task <Skill> GetOrCreateSkillAsync(string skillName)
        {
            var trimName = skillName.Trim();

            return(_storageBroker.SelectAllSkills()
                   .FirstOrDefault(skill => skill.Name.ToLower().Equals(trimName.ToLower())) ??
                   await AddSkillAsync(trimName));
        }
Beispiel #2
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();
            }));
        }