public async Task <IActionResult> GetOnlineDashboard(DashboardSearchViewModel dashboard) { try { if (dashboard.PageNo < 1 || dashboard.PageSize < 0) { return(new OkObjectResult(new { Results = Enumerable.Empty <SignalDashboardItem>().ToList(), TotalRecords = 0 })); } var dashBoard = dashboard.PageSize.HasValue && dashboard.PageSize > 0 ? await this.simsApp.OnlineForms.DashboardSearch(search : dashboard.Search ?? "", startPage : dashboard.PageNo, pageSize : dashboard.PageSize.Value) : await this.simsApp.OnlineForms.DashboardSearch(search : dashboard.Search ?? "", startPage : dashboard.PageNo); return(new OkObjectResult(new PagedResultsViewModel <SimsOnlineFormDashboardItem> { Results = dashBoard.ToList(), TotalRecords = dashBoard.TotalResults })); } catch (SIMSException ex) { return(new BadRequestObjectResult(ex.Message)); } }
public async Task <IActionResult> GetIncidentDashboard(DashboardSearchViewModel dashboard) { log.LogInformation($"search terms : {dashboard.Search} {dashboard.PageNo} {dashboard.PageSize}", "GetIncidentsDashboard"); if (dashboard.PageNo < 1 || dashboard.PageSize < 0) { return(new OkObjectResult(new { Results = Enumerable.Empty <IncidentDashboardItem>(), TotalRecords = 0 })); } var dashBoard = dashboard.PageSize.HasValue && dashboard.PageSize > 0 ? await this.simsApp.Incidents.DashboardSearch(search : dashboard.Search ?? "", startPage : dashboard.PageNo, pageSize : dashboard.PageSize.Value) : await this.simsApp.Incidents.DashboardSearch(search : dashboard.Search ?? "", startPage : dashboard.PageNo); return(new OkObjectResult(new { Results = dashBoard, TotalRecords = dashBoard.TotalResults })); }
/// <summary> /// Class Constructor /// </summary> /// <param name="view">Instance of the View</param> public DashboardSearchPresenter(IDashboardSearchView view) { this._view = view; _viewModel = new DashboardSearchViewModel(view); }