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

            context.Jokes.Add(újVicc);
            context.SaveChanges();
        }
Exemplo n.º 2
0
        public int M3()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            int viccekSzama = context.Jokes.Count();

            return(viccekSzama);
        }
Exemplo n.º 3
0
        public ActionResult M1()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            var viccek = from x in context.Jokes
                         select x.JokeText;

            return(new JsonResult(viccek));
        }
Exemplo n.º 4
0
        public Joke Get(int id)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            var joke = (from x in context.Jokes where x.JokeSk == id select x).FirstOrDefault();

            return(joke);
        }
Exemplo n.º 5
0
        public string Get(int id)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            var keresettVicc             = (from x in context.Jokes
                                            where x.JokeSk == id
                                            select x).FirstOrDefault();

            return(keresettVicc);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public Joke Get(int id)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            var keresettVicc             = (from i in context.Jokes
                                            where i.JokeSk == id
                                            select i).FirstOrDefault();

            return(keresettVicc);
        }
Exemplo n.º 8
0
        public ActionResult Get(int id)
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();
            var keresettVicc             = (from x in context.Jokes
                                            where x.JokeSk == id
                                            select x).FirstOrDefault();

            if (keresettVicc == default)
            {
                return(BadRequest("Nincs ilyen sorszámú vicc!"));
            }

            return(new JsonResult(keresettVicc));
        }
Exemplo n.º 9
0
        public IEnumerable <Joke> Get()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            return(context.Jokes.ToList());
        }
Exemplo n.º 10
0
        public IEnumerable <string> Get()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            return((IEnumerable <string>)context.Jokes.ToList());
        }
Exemplo n.º 11
0
        public IEnumerable <JokeModels.Joke> Get()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            return(context.Jokes.ToList()); //az IEnumerable után a<>-ben nem biztos, hogy JokeModels.Joke van
        }
Exemplo n.º 12
0
        public int JokeCount()
        {
            FunnyDatabaseContext context = new FunnyDatabaseContext();

            return(context.Jokes.Count());
        }