public bool AddWinnerToBd(string suggest = "") { Models.Play play = new Models.Play(); play.suggest = suggest; db.Games.Add(play); db.SaveChanges(); return(true); }
public Play(Models.Play play) { this.Id = play.Id; this.Date = play.Date; this.GameId = play.GameId; this.PlayerIds = play.Players.Select(p => p.Id); //Selecting just the Id from each of the players this.PlayerNames = play.Players.Select(p => p.Name); //Selecting just the Name from each of the players this.NumPlayers = play.Players.Count(); ///This is shorthand for an "if" statement. The "?" is the "if" and the format is: ///[condition] ? [value if true] : [value if false] this.GameName = play.Game != null ? play.Game.Name : ""; }