public async Task<IActionResult> PutCustomerDetail([FromRoute] int id, [FromBody] CustomerDetail customerDetail) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != customerDetail.CustomerId) { return BadRequest(); } _context.Entry(customerDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerDetailExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task <IActionResult> PutCustomerDetail(int id, CustomerDetail customerDetail) { if (id != customerDetail.CUST_ID) { return(BadRequest()); } _context.Entry(customerDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }