public void Post([FromBody] Train newTrain) { bestdbContext context = new bestdbContext(); context.Trains.Add(newTrain); context.SaveChanges(); }
public void Delete(int id) { bestdbContext context = new bestdbContext(); var deleteTrain = (from x in context.Trains where x.Id == id select x).FirstOrDefault(); context.Trains.Remove(deleteTrain); context.SaveChanges(); }