Beispiel #1
0
        public void Delete(int id)
        {
            JokeModels.FunnyDatabaseContext context = new JokeModels.FunnyDatabaseContext();
            var törlendőVicc = (from x in context.Jokes
                                where x.JokeSk == id
                                select x).FirstOrDefault();

            context.Remove(törlendőVicc);
        }
Beispiel #2
0
        public JokeModels.Joke Get(int id)
        {
            JokeModels.FunnyDatabaseContext context = new JokeModels.FunnyDatabaseContext();
            var keresettVicc = (from x in context.Jokes
                                where x.JokeSk == id
                                select x).FirstOrDefault();

            return(keresettVicc);
        }
Beispiel #3
0
 public void Post([FromBody] JokeModels.Joke újVicc)
 {
     JokeModels.FunnyDatabaseContext context = new JokeModels.FunnyDatabaseContext();
     context.Jokes.Add(újVicc);
     context.SaveChanges();
 }
Beispiel #4
0
 public IEnumerable <JokeModels.Joke> Get()
 {
     JokeModels.FunnyDatabaseContext context = new JokeModels.FunnyDatabaseContext();
     return(context.Jokes.ToList());
 }