public ActionResult <IEnumerable <Food> > Get() { try { return(Ok(_fs.Get())); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <List <Food> > > GetFood(string query, int page_limit) { var search = query.ToLower().Split(" "); return(await _foodsService.Get() .Search(x => x.Name.ToLower(), x => x.Manufacturer.ToLower()) .Containing(search) .OrderBy(f => f.LastUsed).ThenBy(f => f.TimesUsed) .Take(page_limit) .ToListAsync()); }