public async Task <GetResponse <IPayrollLimit> > GetAsync(PayrollLimitRequest request) { var response = new GetResponse <IPayrollLimit>(); try { using (var connection = ConnectionFactory.GetConnection()) { var sql = $@"{GetSelectStatement()} AND [State] = @state AND [ClientId] = @clientId "; var results = await connection.QuerySingleAsync <PayrollLimitDto>(sql, new { State = request.State, ClientId = request.ClientId }); response.Content = results.ToModel(); } } catch (Exception e) { var messaage = $@"Unable to retrieve payroll limit records."; response.AddError(e); LogManager.LogError(e, messaage); Console.WriteLine(e); } return(response); }
public async Task <GetResponse <IPayrollLimit> > GetAsync(PayrollLimitRequest request) { var getResponse = new GetResponse <IPayrollLimit>(); try { getResponse = await _payrollLimitRepository.GetAsync(request); } catch (Exception ex) { Console.WriteLine(ex); getResponse.AddError(ex); _logManager.LogError(ex, "Error retrieving payrollLimit"); } return(getResponse); }
public async Task <GetResponse <IReadOnlyList <IPayrollLimit> > > GetAllAsync(PayrollLimitRequest request) { var response = new GetResponse <IReadOnlyList <IPayrollLimit> >(); try { using (var connection = ConnectionFactory.GetConnection()) { var sql = $@"{GetSummarySelectStatement()} AND [State] = @state"; var results = await connection.QueryAsync <PayrollLimitDto>(sql, new { State = request.State }); response.Content = results .Select(dto => dto.ToModel()) .AsList(); } } catch (Exception e) { var messaage = $@"Unable to retrieve payroll limit records."; response.AddError(e); LogManager.LogError(e, messaage); Console.WriteLine(e); } return(response); }