Ejemplo n.º 1
0
        public ActionResult <ItemResponse <Paged <ProviderBase> > > SelectByUserId(int id, int pageIndex, int pageSize)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                Paged <ProviderBase> providers = _service.SelectByUserId(id, pageIndex, pageSize);
                if (providers == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App resource not found.");
                }
                else
                {
                    response = new ItemResponse <Paged <ProviderBase> >()
                    {
                        Item = providers
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
            }

            return(StatusCode(code, response));
        }