コード例 #1
0
        public async Task <IActionResult> TechNote(int?page, int?id, int?searchtype, string query)
        {
            if (id.HasValue && id.Value > 0)
            {
                return(RedirectToAction("TechNoteView", new { id = id }));
            }

            if (!page.HasValue)
            {
                page = 1;
            }
            else
            if (page.Value == 0)
            {
                page = 1;
            }

            TechNoteViewModel searchModel = new TechNoteViewModel();

            searchModel.PageNumber = page.Value;
            if (!string.IsNullOrWhiteSpace(query))
            {
                searchModel.TechNoteSearchCriteria.SearchType   = (TechNote.SearchType)searchtype.Value;
                searchModel.TechNoteSearchCriteria.SearchString = query;
            }

            searchModel = await _techNoteViewModel.SearchTechNotes(searchModel);

            return(View(searchModel));
        }
コード例 #2
0
 public async Task <IActionResult> TechNote(TechNoteViewModel model)
 {
     if (model.TechNoteSearchCriteria != null && !string.IsNullOrWhiteSpace(model.TechNoteSearchCriteria.SearchString))
     {
         model.PageNumber = 1;
         return(RedirectToAction("TechNote", new { page = 1, searchtype = (int)model.TechNoteSearchCriteria.SearchType, query = model.TechNoteSearchCriteria.SearchString }));
     }
     else
     {
         model.TechNotes.CurrentPage = 1;
         return(RedirectToAction("TechNote", new { page = 1, searchtype = HNS.Entities.TechNote.SearchType.Title, query = "" }));
     }
 }
コード例 #3
0
        public async Task <IActionResult> TechNote(TechNoteViewModel model)
        {
            if (model.TechNoteSearchCriteria != null && !string.IsNullOrWhiteSpace(model.TechNoteSearchCriteria.SearchString))
            {
                model.PageNumber = 1;
                HttpContext.Session.SetObjectAsJson("TechNoteViewModel", model);
                model = await _techNoteViewModel.SearchTechNotes(model);
            }
            else
            {
                HttpContext.Session.Remove("TechNoteViewModel");
                model.TechNotes.CurrentPage = 1;
                model = await _techNoteViewModel.GetAllTechNotes(model.TechNotes.CurrentPage);
            }

            return(View(model));
        }