public IActionResult Get() { try { return(Ok(_repository.GetAllProducts())); } catch (Exception exc) { _logger.LogError($"Failed to get products: {exc}"); return(BadRequest("Failed to get products")); } }
public IActionResult Shop() { /* var results = _context.Products * .OrderBy(p => p.Category) * .ToList(); * return View(); */ /* var results = from p in _context.Products * orderby p.Category * select p; * return View(results.ToList()); */ var results = _repository.GetAllProducts(); return(View(results)); }