public ActionResult Edit(Game game, int developerId) { bool duplicate = _db.DeveloperGame.Any(devGame => devGame.DeveloperId == developerId && devGame.GameId == game.GameId); if (developerId != 0 && !duplicate) { _db.DeveloperGame.Add(new DeveloperGame() { DeveloperId = developerId, GameId = game.GameId }); } _db.Entry(game).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Developer developer) { _db.Entry(developer).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }