Пример #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);
        }
Пример #2
0
 public void UpdateGenre(GameGenre genre)
 {
     if (genre != null)
     {
         Context.Entry(genre).State = EntityState.Modified;
     }
 }
Пример #3
0
 public void CreateGenre(GameGenre genre)
 {
     if (genre != null)
     {
         Context.GameGenres.Add(genre);
     }
 }
Пример #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);
        }