예제 #1
0
 public IActionResult GetAll([FromBody] GetAllFilterDto filter)
 {
     try
     {
         if (filter == null)
         {
             throw new BasicException("Wrong structure!");
         }
         if (!ModelState.IsValid)
         {
             BadRequest(ModelState);
         }
         User user = _userRep.GetByEmailAdd(this.User.Claims.SingleOrDefault(x => x.Type == "EmailAddress").Value);
         return(Ok(_manager.GetAllDashboard(filter, user)));
     }
     catch (BasicException ex)
     {
         _logger.LogError(ex.Message);
         return(BadRequest(ex.Message));
     }
     catch (NotFoundException ex)
     {
         _logger.LogError(ex.Message);
         return(NotFound(ex.Message));
     }
     catch (PermissionException ex)
     {
         _logger.LogError(ex.Message);
         return(Unauthorized());
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(BadRequest());
     }
 }