public async Task <IActionResult> FAQ(int?page, int?id) { if (id.HasValue && id.Value > 0) { return(RedirectToAction("FAQView", new { id = id })); } if (!page.HasValue) { page = 1; } else if (page.Value == 0) { page = 1; } var searchModel = HttpContext.Session.GetObjectFromJson <FaqViewModel>("FaqViewModel"); if (searchModel != null && searchModel.FaqSearchCriteria != null && !string.IsNullOrWhiteSpace(searchModel.FaqSearchCriteria.SearchString)) { searchModel.PageNumber = 1; HttpContext.Session.SetObjectAsJson("FaqViewModel", searchModel); searchModel = await _faqViewModel.SearchFaqs(searchModel); return(View(searchModel)); } else { var model = await _faqViewModel.GetAllFaqs(page.Value); return(View(model)); } }
public async Task <IActionResult> FAQ(int?page, int?id, int?searchtype, string query) { if (id.HasValue && id.Value > 0) { return(RedirectToAction("FAQView", new { id = id })); } if (!page.HasValue) { page = 1; } else if (page.Value == 0) { page = 1; } FaqViewModel searchModel = new FaqViewModel(); searchModel.PageNumber = page.Value; if (!string.IsNullOrWhiteSpace(query)) { searchModel.FaqSearchCriteria.SearchType = (Faq.SearchType)searchtype.Value; searchModel.FaqSearchCriteria.SearchString = query; } searchModel = await _faqViewModel.SearchFaqs(searchModel); return(View(searchModel)); }