Пример #1
0
        //добавление без валидации
        public async Task <List <Competence> > AddCompetences(ApplicationDbContext db, string[] competences)
        {
            var needAdded = await Competence.CreateInDbIfNeed(db, competences);

            List <CompetenceUser> forAddedRelation = new List <CompetenceUser>();

            needAdded.ForEach(x =>
            {
                forAddedRelation.Add(new CompetenceUser(x.Id, this.Id));
            });
            db.CompetenceUsers.AddRange(forAddedRelation);

            await db.SaveChangesAsync();

            return(needAdded);
        }
Пример #2
0
 public async static Task <List <int> > GetActualInTown(ApplicationDbContext db, int townId)
 {
     return(await Competence.GetActualQueryEntityInTown(db, townId).Select(x1 => x1.Id).ToListAsync());
 }
Пример #3
0
 //получаем сокращенные данные
 public async static Task <List <CompetenceShort> > GetActualShortEntityInTown(ApplicationDbContext db, int?townId)
 {
     return(await Competence.GetActualQueryEntityInTown(db, townId).Select(x1 => new CompetenceShort(x1.Name, x1.Id)).ToListAsync());//Select(x1=>new { x1.Key,Count= x1.Count() })
 }