public async Task AddAsync(AccountNotificationAudit accountNotificationAudit) { Audit audit = new Audit { Email = accountNotificationAudit.Email, Status = accountNotificationAudit.NotificationProcessingStatus.ToString() }; if (!string.IsNullOrEmpty(accountNotificationAudit.Note)) { audit.Notes = accountNotificationAudit.Note.Length <= 5000 ? accountNotificationAudit.Note : accountNotificationAudit.Note.Substring(0, 4999); } accountsContext.Audit.Add(audit); await accountsContext.SaveChangesAsync(); }
public async Task <bool> UpdateIfExistsAsync(CircuitBreakerDetails entity) { var circuitBreaker = accountsContext.CircuitBreaker.FirstOrDefault(); if (circuitBreaker != null) { circuitBreaker.CircuitBreakerStatus = entity.CircuitBreakerStatus.ToString(); circuitBreaker.LastCircuitOpenDate = entity.LastCircuitOpenDate; circuitBreaker.HalfOpenRetryCount = entity.HalfOpenRetryCount; await accountsContext.SaveChangesAsync(); return(true); } return(false); }