public async Task <List <IngredientDto> > Handle(GetIngredientsQuery request, CancellationToken cancellationToken) { var user = await _userAuth.GetUser(request.Username); if (user == null) { throw new RestException(HttpStatusCode.Unauthorized, new { User = "******" }); } var ingredients = await _ingredientGenerator.GetIngredients(user.Id); return(ingredients); }
public async Task <IEnumerable <IngredientDto> > Handle(GetIngredientsQuery request, CancellationToken cancellationToken) { var entities = await _repository.GetAll(cancellationToken : cancellationToken); return(_mapper.Map <IEnumerable <IngredientDto> >(entities)); }