Ejemplo n.º 1
0
        public void Post([FromBody] Joke újVicc)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            context.Jokes.Add(újVicc);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void Delete(int id)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            var törlendőVicc             = (from x in context.Jokes
                                            where x.JokeSk == id
                                            select x).FirstOrDefault();

            context.Remove(törlendőVicc);
            context.SaveChanges();
        }