public void Save(FinishedGameDto finishedGame) { using (var db = new FifteenGameDbFirstEntities()) { db.FinishedGames.Add(GameMapper.Instance.Map <FinishedGame>(finishedGame)); db.SaveChanges(); } }
public void Save(FinishedGameDto finishedGame) { using (var db = new FifteenGameModel()) { var finishedGameEntity = GameMapper.Instance.Map <FinishedGame>(finishedGame); finishedGameEntity.User = db.Users.First(u => u.Id == finishedGame.UserId); db.FinishedGames.Add(finishedGameEntity); db.SaveChanges(); } }