コード例 #1
0
        public List <Model.Ingredients> Get(IngredientsSearchRequest request)
        {
            var query = _context.Set <Ingredients>().AsQueryable();

            if (!string.IsNullOrWhiteSpace(request?.Name))
            {
                query = query.Where(x => x.Name.StartsWith(request.Name));
            }
            query = query.OrderBy(x => x.Name);
            var list = query.ToList();

            return(_mapper.Map <List <Model.Ingredients> >(list));
        }
コード例 #2
0
        public List <Model.IngredientsIngredientTypes> Get(IngredientsSearchRequest request)
        {
            var query = _context.Set <IngredientsIngredientTypes>().AsQueryable();

            if (request?.IngredientTypeID.HasValue == true)
            {
                query = query.Where(x => x.IngredientTypeId == request.IngredientTypeID);
            }
            if (request?.IngredientID.HasValue == true)
            {
                query = query.Where(x => x.IngredientId == request.IngredientID);
            }
            var list = query.ToList();

            return(_mapper.Map <List <Model.IngredientsIngredientTypes> >(list));
        }
コード例 #3
0
        public List <Reviews> Get(ReviewsSearchRequest request = null)
        {
            var query = _context.Set <Database.Reviews>().AsQueryable();

            if (request?.ProductId.HasValue == true)
            {
                query = query.Where(x => x.ProductId == request.ProductId);
            }
            if (request?.UserId.HasValue == true)
            {
                query = query.Where(x => x.UserId == request.UserId);
            }
            var list = query.ToList();

            return(_mapper.Map <List <Reviews> >(list));
        }
コード例 #4
0
        public virtual IList <T> Get(TSearch request = default)
        {
            var list = _context.Set <TDb>().ToList();

            return(_mapper.Map <IList <T> >(list));
        }