コード例 #1
0
        public ActionResult <SecondaryCustomer> PutSecondaryCustomer(long id, SecondaryCustomer secondaryCustomer)
        {
            if (id != secondaryCustomer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(secondaryCustomer).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SecondaryCustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(secondaryCustomer);
        }
コード例 #2
0
        public ActionResult <SecondaryCustomer> PostSecondaryCustomer(SecondaryCustomer secondaryCustomer)
        {
            _context.SecondaryCustomer.Add(secondaryCustomer);
            _context.SaveChanges();

            return(CreatedAtAction("GetSecondaryCustomer", new { id = secondaryCustomer.Id }, secondaryCustomer));
        }