public async Task <IActionResult> Get(string sort, string search, string author, string industry, string tag) { var model = await _reportServices.GetReports(sort, search, author, industry, tag); if (model.Count == 0) { return(NotFound(new { message = "No Reports found." })); } return(Ok(model)); }
public async Task <IActionResult> Index(string sort, string search, string author, string industry, string tag, int?pageNumber) { ViewData["CurrentSort"] = sort; ViewData["SortByTitle"] = sort == "title" ? "title_desc" : "title"; ViewData["SortByAuthor"] = sort == "author" ? "author_desc" : "author"; ViewData["SortByIndustry"] = sort == "industry" ? "industry_desc" : "industry"; ViewData["SortByDate"] = sort == "newest" ? "oldest" : "newest"; ViewData["SortByDownloads"] = sort == "downloads" ? "downloads_asc" : "downloads"; ViewData["PageNumber"] = pageNumber; ViewData["Search"] = search; ViewData["Industry"] = industry; ViewData["Tag"] = tag; ViewData["Author"] = author; var reports = await _reportServices.GetReports(sort, search, author, industry, tag); ViewData["ResultsCount"] = reports.Count; int pageSize = 8; return(View(await reports.ToPagedListAsync(pageNumber ?? 1, pageSize))); }