private Dictionary <string, AttributeValue> Map(BillingAlertItem billingAlert) { return(new Dictionary <string, AttributeValue> { { IdAttribute, new AttributeValue { N = billingAlert.CustomerId.ToString() } }, { nameof(BillingAlertItem.AlertAmountThreshold).ToLower(), new AttributeValue { N = billingAlert.AlertAmountThreshold.ToString() } }, { nameof(BillingAlertItem.TotalBillAmount).ToLower(), new AttributeValue { N = billingAlert.TotalBillAmount.ToString() } }, { nameof(BillingAlertItem.BillAmountLastUpdated).ToLower(), new AttributeValue { S = billingAlert.BillAmountLastUpdated.ToString() } }, { nameof(BillingAlertItem.IsAlerted).ToLower(), new AttributeValue { BOOL = billingAlert.IsAlerted } } }); }
private bool ShouldAlert(BillingAlertItem billingAlert) => !billingAlert.IsAlerted && billingAlert.TotalBillAmount >= billingAlert.AlertAmountThreshold;
private string DefaultAlertMessage(BillingAlertItem billingAlert) => $"Your toll amount for {DateTime.Now.Month}/{DateTime.Now.Year} is ${billingAlert.TotalBillAmount} and has exceeded the threshold value of {billingAlert.AlertAmountThreshold}";