Пример #1
0
        // Add customer
        public async Task <Customer> AddCustomer(Customer customer)
        {
            _context.Customers.Add(customer);
            await _context.SaveChangesAsync();

            return(customer);
        }
Пример #2
0
        public async Task <ActionResult <CustomerCustomerAddress> > PostCustomerCustomerAddress(CustomerCustomerAddress customerCustomerAddress)
        {
            _context.CustomerCustomerAddress.Add(customerCustomerAddress);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CustomerCustomerAddressExists(customerCustomerAddress.Customer))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCustomerCustomerAddress", new { id = customerCustomerAddress.Customer }, customerCustomerAddress));
        }