Exemplo n.º 1
0
        public ActionResult <ItemsResponse <FaqCategory> > GetCategories()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                List <FaqCategory> list = _service.GetCategories();

                if (list == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App Resource not found.");
                }
                else
                {
                    response = new ItemsResponse <FaqCategory> {
                        Items = list
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }


            return(StatusCode(code, response));
        }