Пример #1
0
 // 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());
 }
Пример #2
0
 public IActionResult Get([FromQuery] TypeSearch search)
 {
     try
     {
         var tip = _getTypesCommand.Execute(search);
         return(Ok(tip));
     }
     catch (EntityNotFoundException e)
     {
         if (e.Message == "Type doesn't exist.")
         {
             return(NotFound(e.Message));
         }
         return(UnprocessableEntity(e.Message));
     }
 }