public void FaqService_GetAll() { IFaqService service = this.GetService <IFaqService>(); List <FaqIndexModel> configList = service.Get(); Assert.IsTrue(configList.Count > 0, "There are no records in the Config Table"); }
public ActionResult <ItemsResponse <Faq> > Get() { int code = 200; BaseResponse response = null; try { List <Faq> list = _service.Get(); if (list == null) { code = 404; response = new ErrorResponse("App Resource not found."); } else { response = new ItemsResponse <Faq> { Items = list }; } } catch (Exception ex) { code = 500; response = new ErrorResponse(ex.Message); base.Logger.LogError(ex.ToString()); } return(StatusCode(code, response)); }
public HttpResponseMessage Get() { try { List <FaqIndexModel> response = new List <FaqIndexModel>(); response = _faqService.Get(); return(Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception ex) { _errorService.LogError(ex); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public HttpResponseMessage GetById(int id) { // if the Model does not pass validation, there will be an Error response returned with errors if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <FAQ> response = new ItemResponse <FAQ>(); response.Item = _faqService.Get(id); return(Request.CreateResponse(response)); }
public ActionResult Index() { return(View(faqService.Get())); }
public ActionResult Index() { List <Faq> faqList = faqService.Get(); return(View(faqList)); }
public ActionResult View(int id) { Faq @faq = faqService.Get(id); return(View(@faq)); }