예제 #1
0
        public ActionResult <ItemResponse <Faq> > GetAll(int categoryId)

        {
            int          iCode    = 200;
            BaseResponse response = null;

            try
            {
                Faq faq = _service.GetAll(categoryId);

                if (faq == null)
                {
                    iCode    = 404;
                    response = new ErrorResponse("Application Resource not found. The thing you came for is not here.");
                }
                else
                {
                    response = new ItemResponse <Faq> {
                        Item = faq
                    };
                }
            }
            catch (Exception ex)
            {
                iCode = 500;

                base.Logger.LogError(ex.ToString());
                response = new ErrorResponse($"Generic Error: { ex.Message }");
            }


            return(StatusCode(iCode, response));
        }
예제 #2
0
        public IActionResult GetAll()
        {
            var entity = _manager.GetAll();

            if (entity.Count == 0)
            {
                return(NoResult());
            }
            return(ResponseJson(entity));
        }
예제 #3
0
        // GET: Faq
        public ActionResult Index()
        {
            var menuitem = _faqService.GetAll();

            return(View(menuitem));
        }