Esempio n. 1
0
 public IActionResult Get(int id)
 {
     try
     {
         var search = new OrderSearch
         {
             Id = id
         };
         var result = _getOrders.Execute(search);
         return(Ok(result.First()));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Esempio n. 2
0
 public IActionResult Search([FromForm] OrderSearch search)
 {
     try
     {
         var viewmodel = _getOrders.Execute(search);
         return(PartialView(viewmodel));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }