public GroupTable(Group group) { this.TournamentID = group.TournamentID; this.TournamentName = group.Tournament.Name; this.GroupID = group.GroupID; this.GroupName = group.Name; List<TeamSummary> summary = new List<TeamSummary>(); foreach (Team team in group.Teams) { summary.Add(new TeamSummary(team)); } this.Teams = summary; this.OtherGroups = new Dictionary<int, string>(); foreach (Group otherGroup in group.Tournament.Groups.OrderBy(g => g.Name)) { if (otherGroup.GroupID != group.GroupID) { this.OtherGroups.Add(otherGroup.GroupID, otherGroup.Name); } } }
public ActionResult Add(Group group) { if (!String.IsNullOrEmpty(group.Name) && group.TournamentID > 0) { using (TournamentEntities data = new TournamentEntities()) { data.Groups.AddObject(group); data.SaveChanges(); } } return RedirectToAction("Index", "Tournament", new { id = group.TournamentID }); }
/// <summary> /// Create a new Group object. /// </summary> /// <param name="groupID">Initial value of the GroupID property.</param> /// <param name="tournamentID">Initial value of the TournamentID property.</param> /// <param name="name">Initial value of the Name property.</param> public static Group CreateGroup(global::System.Int32 groupID, global::System.Int32 tournamentID, global::System.String name) { Group group = new Group(); group.GroupID = groupID; group.TournamentID = tournamentID; group.Name = name; return group; }
/// <summary> /// Deprecated Method for adding a new object to the Groups EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGroups(Group group) { base.AddObject("Groups", group); }