Esempio n. 1
0
        public void ModifyCustomer(Customer old, Modification[] modifications)
        {
            var record = new Record()
            {
                Message = $"Modification customer {old.FullString()}: " + string.Join(", ", modifications.Select(m => $"property {m.Type} =>  from '{m.OldValue}' to '{m.NewValue}', ")),
            };

            _context.Records.Add(record);
            CustomersChanged?.Invoke();
        }
Esempio n. 2
0
        public void AddCustomer(Customer customer)
        {
            var record = new Record()
            {
                Message = $"Added new customer: {customer.FullString()}"
            };

            _context.Customers.Add(customer);
            _customers.Add(customer);
            _context.Records.Add(record);
            CustomersChanged?.Invoke();
        }
Esempio n. 3
0
        public async void AddCustomerAsync(Customer customer)
        {
            await Task.Factory.StartNew(() =>
            {
                var record = new Record()
                {
                    Message = $"Added new customer: {customer.FullString()}"
                };
                _context.Customers.Add(customer);
                _context.Records.Add(record);
                _context.SaveChanges();
            });

            _customers.Add(customer);
            CustomersChanged?.Invoke();
        }
Esempio n. 4
0
        public async void ModifyCustomerAsync(Customer old, Modification[] modifications)
        {
            await Task.Factory.StartNew(() =>
            {
                var record = new Record()
                {
                    Message = $"Modification customer {old.FullString()}: " + string.Join(", ",
                                                                                          modifications.Select(m =>
                                                                                                               $"property {m.Type} =>  from '{m.OldValue}' to '{m.NewValue}', ")),
                };
                _context.Records.Add(record);
                _context.SaveChanges();
            });

            CustomersChanged?.Invoke();
        }