예제 #1
0
        public Task <PagedList <SimpleRecipeQueryResultDto> > GetUserRecipes(GetUserRecipesQueryDto request)
        {
            var query = from recipe in _context.Recipes
                        where recipe.OwnerId == request.UserId
                        select new SimpleRecipeQueryResultDto
            {
                RecipeGuid = recipe.RecipeGuid,
                Name       = recipe.Name
            };

            query = query.OrderBy(x => x.Name);

            return(_pageableRequestHelper.GetPagedListAsync(query, request));
        }
예제 #2
0
        public Task <PagedList <SimpleProductQueryResultDto> > GetSimpleProductsList(GetSimpleProductsQueryDto model)
        {
            var query = from product in _context.Products
                        join productCategory in _context.ProductCategories on product.ProductCategoryId equals productCategory.ProductCategoryId
                        select new SimpleProductQueryResultDto
            {
                Name                = product.Name,
                ProductGuid         = product.ProductGuid,
                ProductCategoryGuid = productCategory.ProductCategoryGuid,
                ProductCategoryName = productCategory.Name
            };

            query = query.OrderBy(x => x.Name);

            return(_pageableRequestHelper.GetPagedListAsync(query, model));
        }