public ActionResult Edit() { var groupsContext = new GroupsContext(); Groups group = groupsContext.Groups.ToList().First(x => x.SexMale = true); return View(group); }
public ActionResult Bracket(int id) { var groups = new GroupsContext(); Groups group = groups.Groups.Single(x => x.Id == id); var registrationsContext = new RegistrationContext(); var registrations = registrationsContext.Registration.Where(r => r.GroupId == id).ToList(); List<ApplicationUser> usersInGroup = new List<ApplicationUser>(); var allUsers = new ApplicationDbContext(); List<GroupWithUsers> allUsersInTournament = new List<GroupWithUsers>(); foreach (var regs in registrations) { if (group.Id == regs.GroupId) { usersInGroup.Add( allUsers.Users.Single(u => u.Id == regs.UserId)); } } if (group.ClosedRegistation == true) { if (group.IdFinalFight == null) { } //show } return View(group); }
public void AddGroup(Groups group) { using (var groupsContext = new GroupsContext()) { groupsContext.Entry(group).State = System.Data.Entity.EntityState.Added; groupsContext.SaveChanges(); } }
public string AddGroup(string weight, string belt, string gender) { var groupContext = new GroupsContext(); var sexMale = gender.Equals("true") ? true : false; Groups newGroup = new Groups(Int32.Parse(weight), sexMale, belt, 3); groupContext.Groups.Add(newGroup); groupContext.SaveChanges(); var gen = gender.Equals("true") ? "muz" : "zena"; return gen + " - " + belt + " - " + weight; }
private Tournament ForDetails(string currentUser, int tournamentId) { var tournamentsContext = new TournamentsContext(); var tournament = tournamentsContext.Tournament.Single(t => t.Id == tournamentId); ViewBag.tournamentId = tournament.Id; var groupsContext = new GroupsContext(); var tournamentGroups = groupsContext.Groups.Where(g => g.IdTournament == tournament.Id).ToList(); ViewBag.Groups = tournamentGroups; List<GroupWithUsers> allUsersInTournament = AllUsersInTournament(tournament.Id, tournamentGroups); allUsersInTournament.Sort(); ViewBag.AllUsersInTournament = allUsersInTournament; SelectList selectList = new SelectList(GetItemsForDropDownList(tournamentGroups), "Value", "Text"); ViewBag.SelectList = selectList; ViewBag.InTournament = CurrentUserInTournament(tournament.Id, currentUser); ViewBag.Paid = DidPay(tournamentId, currentUser); ViewBag.IsAdmin = (currentUser == tournament.OrganizerId) ? true : false; return tournament; }