コード例 #1
0
 public ActionResult Update(Guid? id)
 {
     if (id.HasValue)
     {
         var entity = ProductManager.FindGenreById(id.Value);
         var model = new GenreViewModel
         {
             Id = entity.Id,
             Name = entity.Name
         };
         return View("Update", model);
     }
     return RedirectToAction("Index");
 }
コード例 #2
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);
        }
コード例 #3
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);
        }