public async Task <IActionResult> PutStoptimeItem([FromRoute] string id, [FromBody] StoptimeItem stoptimeItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stoptimeItem.primary_key) { return(BadRequest()); } _context.Entry(stoptimeItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoptimeItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostStoptimeItem([FromBody] StoptimeItem stoptimeItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Stoptimes.Add(stoptimeItem); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStoptimeItem", new { id = stoptimeItem.primary_key }, stoptimeItem)); }