public CustomerTierEntity(CustomerTierModel model)
 {
     Id         = model.Id;
     CustomerId = model.CustomerId;
     TierId     = model.TierId;
     Timestamp  = model.Timestamp;
 }
        public async Task InsertAsync(CustomerTierModel customerTier)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity = new CustomerTierEntity(customerTier);

                context.CustomerTiers.Add(entity);

                await context.SaveChangesAsync();
            }
        }
        protected override async Task ProcessMessageAsync(CustomerTierChangedEvent message)
        {
            var model = new CustomerTierModel
            {
                Id         = Guid.NewGuid().ToString(),
                CustomerId = message.CustomerId.ToString(),
                TierId     = message.TierId.ToString(),
                Timestamp  = DateTime.UtcNow
            };

            await _operationsService.ProcessCustomerTierChangedEventAsync(model);

            _log.Info("Processed customer tier changed event",
                      context: $"customerId: {message.CustomerId}; tierId: {message.TierId}");
        }
 public Task ProcessCustomerTierChangedEventAsync(CustomerTierModel customerTier)
 {
     return(_customerTierRepository.InsertAsync(customerTier));
 }