public async Task <IActionResult> PutTcrossing(short id, Tcrossing tcrossing) { if (id != tcrossing.TcrossingId) { return(BadRequest()); } _context.Entry(tcrossing).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TcrossingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tcrossing> > PostTcrossing(Tcrossing tcrossing) { _context.Tcrossing.Add(tcrossing); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TcrossingExists(tcrossing.TcrossingId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTcrossing", new { id = tcrossing.TcrossingId }, tcrossing)); }