Beispiel #1
0
        public void GetDivisionTeamsTest2()
        {
            var divisions = new List<Division>();
            using (var context = new CSBCDbContext())
            {
                var repSeason = new SeasonRepository(context);
                var currentSeason = repSeason.GetCurrentSeason(1);
                var repDivision = new DivisionRepository(context);
                divisions = repDivision.GetDivisions(currentSeason.SeasonID).ToList<Division>();
            }
            var division = divisions.FirstOrDefault();
            var rep = new TeamVM();
            var teams = rep.GetDivisionTeams(division.DivisionID);

            Assert.IsTrue(teams.Any());

            var team = teams.FirstOrDefault();
            Assert.IsTrue(team.DivisionID > 0);
        }
Beispiel #2
0
        private void LoadTeams(Int32 divisionId)
        {
            var rep = new TeamVM();

            try
            {
                var teams = rep.GetDivisionTeams(divisionId);
                grdTeams.DataSource = teams;
                grdTeams.DataBind();
            }
            catch (Exception ex)
            {
                lblError.Text = "LoadTeams::" + ex.Message;
            }
        }
Beispiel #3
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     var rep = new TeamVM();
     var divisionId = Convert.ToInt32(lblDivisionID.Value);
     var teams = rep.GetDivisionTeams(divisionId);
     if (teams.Count() > 0)
     {
         lblError.Text = "Cannot delete Division because teams exist!";
     }
     else
     {
         var repDivision = new DivisionRepository(new CSBCDbContext());
         repDivision.Delete(repDivision.GetById(divisionId));
         LoadDivisions();
         DivisionId = 0;
         //LoadTeams();
     }
 }