public async Task <PlanningOfficeGetAllResponse> GetAllAsync(PlanningOfficeGetAllRequest req) { var resp = new PlanningOfficeGetAllResponse(); 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].[uspPlanningOfficesGetList_New]"; await conn.OpenAsync(); var dynparam = new { Query = tempQuery }; var rawResult = await conn.QueryAsync <PlanningOfficeDTO>(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 <PlanningOfficeGetAllResponse> GetAllAsync(PlanningOfficeGetAllRequest req) { var result = await _repos.GetAllAsync(req); return(result); }
public async Task <IActionResult> PlanningOfficeGetAllAsync(PlanningOfficeGetAllRequest req) { var result = await _planningOfficeManager.GetAllAsync(req); return(Ok(result)); }