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)); }
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)); }
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)); }
public virtual IList <T> Get(TSearch request = default) { var list = _context.Set <TDb>().ToList(); return(_mapper.Map <IList <T> >(list)); }