public ActionResult AddLeague(League league)
 {
     if (ModelState.IsValid)
     {
         var manager = new LeagueManager();
         manager.AddLeague(league);
         return RedirectToAction("Leagues");
     }
     return View();
 }
Exemple #2
0
 public void AddLeague(League league)
 {
     if (GetAllLeagues().Count != 0)
     {
         league.Id = GetAllLeagues().LastOrDefault().Id + 1;
     }
     else
     {
         league.Id = 1;
     }
     _leaguerepo.AddLeague(league);
 }
 /// <summary>
 /// will edit a league taht is passed in and allow them to change the other properties
 /// </summary>
 /// <param name="league"></param>
 public void EditLeague(League league)
 {
     var selectedLeague = _leagues.FirstOrDefault(l => l.Id == league.Id);
     selectedLeague.Name = league.Name;
     WriteFile();
 }
 /// <summary>
 /// will add the league to the repository from the league that is passed in 
 /// </summary>
 /// <param name="league"></param>
 public void AddLeague(League league)
 {
     _leagues.Add(league);
     WriteFile();
 }
        public ActionResult EditLeague(int id)
        {
            var manager = new LeagueManager();
            League league = new League();
            league.Id = id;
            var editLeague = manager.GetLeagueById(league.Id);

            return View(editLeague);
        }
        public ActionResult DeleteLeague(League league)
        {
            var manager = new LeagueManager();
            manager.DeleteLeagueById(league.Id);

            return RedirectToAction("Leagues");
        }
Exemple #7
0
 public void EditLeague(League league)
 {
     _leaguerepo.EditLeague(league);
 }
 public void AddLeague(League league)
 {
     _leagues.Add(league);
 }