public ActionResult Save(VideoG videoG) { ModelState.Remove("videoG.Id"); if (!ModelState.IsValid) { var viewModel = new VideoGIndexViewModel { VideoG = videoG }; return(View("FormVideoGame", viewModel)); } if (videoG.Id != 0) { _context.Entry(videoG).State = System.Data.Entity.EntityState.Modified; } else { _context.VideoGs.Add(videoG); } _context.SaveChanges(); return(RedirectToAction("IndexConsole")); }
public ActionResult IndexConsole() { var videoGameIndexview = new VideoGIndexViewModel() { VideoGs = _context.VideoGs.ToList() }; return(View(videoGameIndexview)); }
public ActionResult Edit(int id) { var videoG = _context.VideoGs.SingleOrDefault(c => c.Id == id); if (videoG == null) { return(HttpNotFound()); } var viewModel = new VideoGIndexViewModel() { VideoG = videoG }; return(View("FormVideoGame", viewModel)); }
public ActionResult New() { var viewModel = new VideoGIndexViewModel(); return(View("FormVideoGame", viewModel)); }