public decimal GetRebateAmount(int accountId) { decimal amount = 0; string sql = "select sum(reateAmount) as amount from fz_Rebate where accountId=@accountId and state=1"; var list = new QueryObject <AmountModel>(_databaseInstance, sql, new { accountId = accountId }); if (list != null && list.FirstOrDefault() != null) { amount = list.FirstOrDefault().amount; } return(amount); }