Пример #1
0
        public void Post([FromBody] Train newTrain)
        {
            bestdbContext context = new bestdbContext();

            context.Trains.Add(newTrain);
            context.SaveChanges();
        }
Пример #2
0
        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();
        }