public ActionResult <ItemResponse <Paged <Provider> > > SelectByState(int id, int pageIndex, int pageSize) { int code = 200; BaseResponse response = null; try { Paged <Provider> pagedItems = _service.SelectByState(id, pageIndex, pageSize); if (pagedItems == null) { code = 404; response = new ErrorResponse("App resource not found."); } else { response = new ItemResponse <Paged <Provider> > { Item = pagedItems }; } } catch (Exception ex) { base.Logger.LogError(ex.ToString()); code = 500; response = new ErrorResponse(ex.Message); } return(StatusCode(code, response)); }