public async Task <IActionResult> PutShirtDetail([FromRoute] int id, [FromBody] ShirtDetail shirtDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shirtDetail.ID) { return(BadRequest()); } _context.Entry(shirtDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShirtDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostShirtDetail([FromBody] ShirtDetail shirtDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ShirtDetails.Add(shirtDetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetShirtDetail", new { id = shirtDetail.ID }, shirtDetail)); }