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"); }
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); }
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); }