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); }
public ActionResult <SecondaryCustomer> PostSecondaryCustomer(SecondaryCustomer secondaryCustomer) { _context.SecondaryCustomer.Add(secondaryCustomer); _context.SaveChanges(); return(CreatedAtAction("GetSecondaryCustomer", new { id = secondaryCustomer.Id }, secondaryCustomer)); }