public HttpResponseMessage GetAll() { List <ScrapedPost> res = new List <ScrapedPost>(); WebScraperService svc = new WebScraperService(); try { res = svc.GetAll(); return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult<Response<List<WebScrapedPost>>> GetAll() { ActionResult result = null; List<WebScrapedPost> postList = null; try { postList = webScraperService.GetAll(); if (postList != null) { result = Ok(postList); } } catch (Exception exception) { throw exception; } return result; }