protected Genre GetGenreFromDataReader(MySqlDataReader dataReader)
        {
            string genreNaam = dataReader.GetString("genrenaam");
            int genreId = dataReader.GetInt32("genre_id");
            bool verslavend = dataReader.GetBoolean("verslavend");
            Genre genre = new Genre { ID = genreId,Naam = genreNaam, Verslavend = verslavend};

            return genre;
        }
Ejemplo n.º 2
0
        public ActionResult CreateGenreModelBinding(Genre genre)
        {
            try
            {
                genreDBController.InsertGenre(genre);

            }
            catch (Exception e)
            {
                ViewBag.Foutmelding = "Er is iets fout gegaan:" + e;
            }
            return RedirectToAction("Index", "Genre");
        }
Ejemplo n.º 3
0
 public ActionResult CreateGenreParameterBinding(String name, String verslavend)
 {
     bool isVerslavend = verslavend == "on";
     Genre genre = new Genre { Naam = name, Verslavend = isVerslavend };
     try
     {
         genreDBController.InsertGenre(genre);
     }
     catch (Exception e)
     {
         ViewBag.Foutmelding = "Er is iets fout gegaan:" + e;
     }
     return RedirectToAction("Index", "Genre");
 }
Ejemplo n.º 4
0
        public ActionResult CreateGenreOldSchool()
        {
            String name = Request["name"];
            bool verslavend = Request["verslavend"] == "on";
            Genre genre = new Genre { Naam = name, Verslavend = verslavend };
            try
            {
                genreDBController.InsertGenre(genre);
            }
            catch (Exception e)
            {
                ViewBag.Foutmelding = "Er is iets fout gegaan:" + e;
            }

            return RedirectToAction("Index", "Genre");
        }
Ejemplo n.º 5
0
        public ActionResult NieuwGame()
        {
            try
            {
                GameViewModel viewModel = new GameViewModel();

                List<Genre> genres = genreDBController.GetGenres();
                Genre emptyGenre = new Genre();
                emptyGenre.ID = -1;
                emptyGenre.Naam = "";
                genres.Insert(0, emptyGenre);

                viewModel.Genres = new SelectList(genres, "ID", "Naam");
                return View(viewModel);
            }
            catch (Exception e)
            {
                ViewBag.FoutMelding = "Er is iets fout gegaan: " + e;
                return View();
            }
        }
Ejemplo n.º 6
0
        private SelectList getSelectListGenres()
        {
            List<Genre> genres = genreDBController.GetGenres();
            Genre emptyGenre = new Genre();
            emptyGenre.ID = -1;
            emptyGenre.Naam = "";
            genres.Insert(0, emptyGenre);

            return new SelectList(genres, "ID", "Naam");
        }
Ejemplo n.º 7
0
        public ActionResult WijzigGenre(Genre genre)
        {
            try
            {
                genreDBController.UpdateGenre(genre);

            }
            catch (Exception e)
            {
                ViewBag.FoutMelding("Er is iets fout gegaan: " + e);

            }
            return RedirectToAction("Index", "Genre");
        }