public async Task <AgencyGetAllResponse> GetAllAsync(AgencyGetAllRequest req) { var resp = new AgencyGetAllResponse(); var tempQuery = string.Empty; var startRow = 0; var endRow = 0; if (req.Predicate != null) { tempQuery = req.Predicate.ConvertToString(); startRow = req.Predicate.StartRow; endRow = req.Predicate.EndRow; } using (var conn = new SqlConnection(_connectionSettings.DefaultConnection)) { const string storeproc = @"[dbo].[uspAgenciesGetList_New]"; await conn.OpenAsync(); var dynparam = new { Query = tempQuery }; var rawResult = await conn.QueryAsync <AgencyDTO>(storeproc, dynparam, null, null, CommandType.StoredProcedure); resp.Total = rawResult != null && rawResult.Any() ? rawResult.Count() : 0; if (startRow >= 0 && endRow >= 0) { resp.Result = rawResult.ToList().Skip(startRow).Take(endRow - startRow).ToList(); } else { resp.Result = rawResult.ToList(); } } return(resp); }
public async Task <IActionResult> AgencyGetAllAsync(AgencyGetAllRequest req) { var result = await _AgencyManager.GetAllAsync(req); return(Ok(result)); }
public async Task <AgencyGetAllResponse> GetAllAsync(AgencyGetAllRequest req) { var result = await _repos.GetAllAsync(req); return(result); }