예제 #1
0
        public async Task <ActionResult <Models.Customer> > PostCustomer(Models.Customer customer)
        {
            _context.Customers.Add(customer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetCustomer), new { id = customer.Id }, customer));
        }
예제 #2
0
        public async Task <ActionResult <Customer> > AddCustomerAsync([FromBody] Customer customer)
        {
            _context.Customers.Add(customer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetCustomerAsync), new { id = customer.Id }, customer));
        }