public async Task <IActionResult> PutTestproducts([FromRoute] int id, [FromBody] Testproducts testproducts) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != testproducts.ProdId) { return(BadRequest()); } _context.Entry(testproducts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestproductsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTestproducts([FromBody] Testproducts testproducts) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Testproducts.Add(testproducts); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTestproducts", new { id = testproducts.ProdId }, testproducts)); }