public async Task <IActionResult> PutCrudTable([FromRoute] int id, [FromBody] CrudTable CrudTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != CrudTable.Id) { return(BadRequest()); } _context.Entry(CrudTable).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CrudTableExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCrudTable([FromBody] CrudTable CrudTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CrudTables.Add(CrudTable); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCrudTable", new { id = CrudTable.Id }, CrudTable)); }