public async Task <IActionResult> PutEntityTest2([FromRoute] int id, [FromBody] EntityTest2 entityTest2) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != entityTest2.ID) { return(BadRequest()); } _context.Entry(entityTest2).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntityTest2Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostEntityTest2([FromBody] EntityTest2 entityTest2) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.EntityTest2.Add(entityTest2); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEntityTest2", new { id = entityTest2.ID }, entityTest2)); }