コード例 #1
0
        public static async Task <IEnumerable <Drill> > GetCategoryOrFailAsync(this IDrillRepository repository, string category)
        {
            var drills = await repository.GetAllByCategoryAsync(category);

            if (drills == null)
            {
                throw new Exception($"Drill with category: '{category}' was not found");
            }

            return(drills);
        }
コード例 #2
0
ファイル: DrillService.cs プロジェクト: spllsb/Chess
        public async Task <IEnumerable <DrillDto> > GetAllCategoryElementAsync(string category)
        {
            var drills = await _drillRepository.GetAllByCategoryAsync(category);

            return(_mapper.Map <IEnumerable <Drill>, IEnumerable <DrillDto> >(drills));
        }