Пример #1
0
        public async Task AddUnsubscribeRecord(string email)
        {
            try
            {
                long recordcount = await _Unsubscribe.CountDocumentsAsync(x => x.Email == email);

                if (recordcount == 0)
                {
                    Unsubscribed newRecord = new Unsubscribed()
                    {
                        Id             = ObjectId.GenerateNewId().ToString(),
                        Email          = email?.ToLower(),
                        UnsubscribedAt = DateTime.UtcNow
                    };
                    await _Unsubscribe.InsertOneAsync(newRecord);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }