Пример #1
0
        private bool Save(CustomerFormData formData)
        {
            var id       = (int)_selectedContact.Value;
            var customer = _customerRepository.Update(id, formData);

            this.UpdateList("Contacts", ToContact(customer));
            return(true);
        }
Пример #2
0
        public Customer Update(int id, CustomerFormData formData)
        {
            var customer = Get(id);

            Update(customer.Name, formData.Person);
            Update(customer.Address, formData.Address);
            Update(customer.Phone, formData.Phone);
            Update(customer.OtherInfo, formData.OtherInfo);
            Update(customer.DriverLicense, formData.DriverLicense);
            customer.Notes = formData.Notes != null ? formData.Notes[nameof(CustomerFormData.Notes)] : customer.Notes;

            return(customer);
        }
Пример #3
0
        public Customer Add(CustomerFormData formData)
        {
            var customer = new Customer
            {
                Id            = _mockData.Max(x => x.Id) + 1,
                Name          = new NameInfo(),
                Address       = new AddressInfo(),
                Phone         = new PhoneInfo(),
                OtherInfo     = new OtherInfo(),
                Company       = new CompanyInfo(),
                DriverLicense = new DriverLicenseInfo(),
                Notes         = string.Empty
            };

            Update(customer.Name, formData.Person);
            Update(customer.Address, formData.Address);
            Update(customer.Phone, formData.Phone);
            Update(customer.OtherInfo, formData.OtherInfo);
            Update(customer.DriverLicense, formData.DriverLicense);

            _mockData.Add(customer);
            return(customer);
        }
Пример #4
0
 public Customer Save(CustomerFormData formData)
 {
     return(_customerRepository.Add(formData));
 }