public IActionResult Get(int id) { try { var search = new ProductSearch { Id = id }; var result = _getProducts.Execute(search); return(Ok(result.First())); } catch (EntityNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
// GET: Products public ActionResult Index(ProductSearch search = null) { try { var result = _get.Execute(search); return(View(result)); } catch (Exception e) { TempData["error"] = "An error has occurred"; return(View()); } }
public IActionResult Index() { var viewmodel = _getProducts.Execute(new ProductSearch()); return(View(viewmodel)); }
// GET: Products public ActionResult Index() { var products = _getProducts.Execute(); return(View(products)); }
public IActionResult Index([FromQuery] ProductQuery productQuery) { return(View(_getProducts.Execute(productQuery))); }
public IActionResult Get([FromQuery] ProductSearch query) { return(Ok(_getCommand.Execute(query))); }