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); }
public async Task <IEnumerable <DrillDto> > GetAllCategoryElementAsync(string category) { var drills = await _drillRepository.GetAllByCategoryAsync(category); return(_mapper.Map <IEnumerable <Drill>, IEnumerable <DrillDto> >(drills)); }