public async Task <IEnumerable <Recipe> > Handle(GetUserRecipes request, CancellationToken cancellationToken) { var recipes = await _repository.GetAll(); return(recipes .Where(x => x.Metadata.Creation.AuthorId == request.UserId) .Skip(request.Amount * request.Page) .Take(request.Amount)); }
public async Task <IEnumerable <Guid> > Handle(GetRandomRecipes request, CancellationToken cancellationToken) { var recipes = await _repository.GetAll(); return(recipes .Select(x => x.Id) .OrderBy(x => Guid.NewGuid()) .AsEnumerable()); }
public async Task <IEnumerable <Recipe> > Handle(GetRecipes request, CancellationToken cancellationToken) { var recipes = await _repository.GetAll(); return(recipes .Select(x => { x.Metadata = null; return x; }) .Skip(request.Page * request.Amount) .Take(request.Amount) .AsEnumerable()); }