Beispiel #1
0
        public async Task UpdateAsync(
            Guid userId,
            CustomerSource oldSource,
            CustomerSource newSource,
            CancellationToken ct)
        {
            var change = oldSource.UpdateWithLog(userId, x =>
            {
                x.Name           = newSource.Name;
                x.IsDeleted      = newSource.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

            _storage.Update(oldSource);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }
Beispiel #2
0
        public async Task UpdateAsync(
            Guid userId,
            CustomerAttribute oldAttribute,
            CustomerAttribute newAttribute,
            CancellationToken ct)
        {
            var change = oldAttribute.UpdateWithLog(userId, x =>
            {
                x.Type           = newAttribute.Type;
                x.Key            = newAttribute.Key;
                x.IsDeleted      = newAttribute.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

            _storage.Update(oldAttribute);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }
Beispiel #3
0
        public async Task UpdateAsync(Guid userId, Customer oldCustomer, Customer newCustomer, CancellationToken ct)
        {
            var change = oldCustomer.UpdateWithLog(userId, x =>
            {
                x.AccountId         = newCustomer.AccountId;
                x.SourceId          = newCustomer.SourceId;
                x.ResponsibleUserId = newCustomer.ResponsibleUserId;
                x.Surname           = newCustomer.Surname;
                x.Name           = newCustomer.Name;
                x.Patronymic     = newCustomer.Patronymic;
                x.Phone          = newCustomer.Phone;
                x.Email          = newCustomer.Email;
                x.BirthDate      = newCustomer.BirthDate;
                x.Image          = newCustomer.Image;
                x.IsDeleted      = newCustomer.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
                x.AttributeLinks = newCustomer.AttributeLinks.Map(x.Id);
            });

            _storage.Update(oldCustomer);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }