示例#1
0
        public void AddNewCustomer(CustomerEntity customerRequest)
        {
            //Check if User already registered with same User-Id

            var existingCustomer = _dataAccess.GetLoggedInCustomer(customerRequest.CustomerId);

            if (existingCustomer != null)
            {
                throw new DuplicateNameException("Customer already registered with this id");
            }


            var newCustomer = new customer()
            {
                AddeddOn    = DateTime.Now,
                Address     = customerRequest.Address,
                CompanyName = customerRequest.CompanyName,
                CustomerId  = customerRequest.CustomerId,
                DisplayName = customerRequest.DisplayName,
                IsActive    = customerRequest.IsActive
            };

            _dataAccess.AddNewCustomer(newCustomer);
        }