public async Task <IActionResult> PutStdSub([FromRoute] int id, [FromBody] StdSub stdSub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stdSub.AutoId) { return(BadRequest()); } _context.Entry(stdSub).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StdSubExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostStdSub([FromBody] StdSub stdSub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.StdSub.Add(stdSub); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStdSub", new { id = stdSub.AutoId }, stdSub)); }