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 DetalhesVideoGame(int id) { if (id > _context.VideoGs.Count()) { return(HttpNotFound()); } VideoG videoDetalhe = _context.VideoGs.Find(id);//(clientes => clientes.Id == id); return(View(videoDetalhe)); }
public ActionResult Delete(int id) { VideoG videoG = _context.VideoGs.SingleOrDefault(c => c.Id == id); if (videoG == null) { return(HttpNotFound()); } else { _context.VideoGs.Remove(videoG); _context.SaveChanges(); return(RedirectToAction("IndexConsole", videoG)); } }