示例#1
0
 private async Task InsertPossibleDisciplineForSkier(IEnumerable <Skier> skiers)
 {
     foreach (var skier in skiers)
     {
         foreach (var discipline in _disciplines)
         {
             await _skierDao.InsertPossibleDisciplineForSkier(skier.Id, discipline.Id);
         }
     }
 }
示例#2
0
        public async Task <bool> UpdatePossibleDisciplines(int skierId, IEnumerable <int> disciplines)
        {
            var skier = await GetSkierById(skierId);

            if (skier == null)
            {
                return(false);
            }
            using var scope = ScopeBuilder.BuildTransactionScope();
            await _skierDao.DeleteAllPossibleDisciplineForSkier(skierId);

            foreach (var discipline in disciplines)
            {
                await _skierDao.InsertPossibleDisciplineForSkier(skierId, discipline);
            }
            scope.Complete();
            return(true);
        }