public async Task <IActionResult> PutRailml(long id, Railml railml) { if (id != railml.RailmlId) { return(BadRequest()); } _context.Entry(railml).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RailmlExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Railml> > PostRailml(Railml railml) { _context.Railml.Add(railml); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (RailmlExists(railml.RailmlId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetRailml", new { id = railml.RailmlId }, railml)); }