Beispiel #1
0
        public ActionResult Create(GenreViewModel model)
        {
            if (ModelState.IsValid)
            {
                var genre = new GameGenre
                {
                     Name = model.Name
                };
                ProductManager.CreateGenre(genre);
                ProductManager.Save();

                return RedirectToAction("Index");
            }
            return View(model);
        }
Beispiel #2
0
 public void UpdateGenre(GameGenre genre)
 {
     if (genre != null)
     {
         Context.Entry(genre).State = EntityState.Modified;
     }
 }
Beispiel #3
0
 public void CreateGenre(GameGenre genre)
 {
     if (genre != null)
     {
         Context.GameGenres.Add(genre);
     }
 }
Beispiel #4
0
        public ActionResult Update(GenreViewModel model)
        {
            if (ModelState.IsValid)
            {
                var category = new GameGenre
                {
                    Id = model.Id,
                    Name = model.Name
                };
                ProductManager.UpdateGenre(category);
                ProductManager.Save();

                return RedirectToAction("Index");
            }
            return View(model);
        }