public ActionResult SearchPost(HolidaySearchVM model, int page = 1) { // Iterate through form keys foreach (string Key in Request.Form.Keys) { // Test if Select button was clicked... if (Key.StartsWith("Search::SearchPost_")) { // Retrieve ID for entity which was selected Guid Value = Guid.Parse(Key.Substring(19)); // Store ID for Edit screen SessionManager.HolidayCode = Value.ToString(); // Call out to Edit screen return(RedirectToAction("Edit", "Holiday", new { code = Value })); } } // Return to the Screen return(View(model)); }
public ActionResult Search(int page = 1) { // Create service instance AdminServiceClient sc = new AdminServiceClient(); // Create model HolidaySearchVM model = new HolidaySearchVM(); try { HolidaySearchVMDC response = sc.SearchHoliday(CurrentUser, CurrentUser, appID, "", null, page, PageSize, true); // Close service communication sc.Close(); //Map response back to view model model.MatchList = Mapper.Map <IEnumerable <HolidaySearchMatchDC>, List <HolidaySearchMatchModel> >(response.MatchList); // Set paging values model.TotalRows = response.RecordCount; model.PageSize = SessionManager.PageSize; model.PageNumber = page; // Store the page number we were on SessionManager.HolidayPageNumber = model.PageNumber; return(View(model)); } catch (Exception e) { // Handle the exception string message = ExceptionManager.HandleException(e, sc); model.Message = message; return(View(model)); } }