public ActionResult <IEnumerable <FuelShow> > Get([FromQuery] FuelSearch query) { try { return(Ok(_getS.Execute(query))); } catch (Exception e) { Console.WriteLine(e.Message); return(StatusCode(500)); } }
// GET: Cars/Create public ActionResult Create() { ViewBag.Categories = _getCategoriesCommand.Execute(new CategorySearch { }); ViewBag.Types = _getTypesCommand.Execute(new TypeSearch { }); ViewBag.Fuels = _getFuelsCommand.Execute(new FuelSearch { }); ViewBag.Models = _getModelsCommand.Execute(new ModelSearch { }); ViewBag.Brands = _getBrandsCommand.Execute(new BrandSearch { }); return(View()); }
public IActionResult Get([FromQuery] FuelSearch search) { try { var goriva = _getFuelsCommand.Execute(search); return(Ok(goriva)); } catch (EntityNotFoundException e) { if (e.Message == "Gorivo doesn't exist.") { return(NotFound(e.Message)); } return(UnprocessableEntity(e.Message)); } }