public async Task <ActionResult> ViewSearch(short SearchDefinitionID) { bool gridvisible = false; ViewBag.grid = gridvisible; var accountId = this.Identity.ToAccountID(); var roleId = this.Identity.ToRoleID(); var userId = this.Identity.ToUserID(); var isSTAdmin = this.Identity.IsSTAdmin(); short ItemsPerPage = default(short); short.TryParse(this.Identity.ToItemsPerPage(), out ItemsPerPage); AddCookie("savedsearchpagesize", ItemsPerPage.ToString(), 1); ViewBag.EmailPermission = cachingService.CheckSendMailPermissions(accountId, roleId); GetSearchResponse response = await advancedSearchService.GetSavedSearchAsync(new GetSearchRequest() { SearchDefinitionID = SearchDefinitionID, AccountId = accountId, RoleId = roleId, IsSTAdmin = isSTAdmin }); response.SearchViewModel.CreatedOn = response.SearchViewModel.CreatedOn.ToJSDate(); if (SearchDefinitionID != 0 && response.SearchViewModel != null) { advancedSearchService.InsertViewActivity(new InsertViewActivityRequest() { AccountId = accountId, RequestedBy = userId, SearchDefinitionId = SearchDefinitionID, SearchName = response.SearchViewModel.SearchDefinitionName }); } return(View("AddEditSearch", response.SearchViewModel)); }