Example #1
0
        public ActionResult Create(Team team)
        {
            if (ModelState.IsValid)
            {
                db.Teams.Add(team);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(team);
        }
Example #2
0
        //Push functions push the objects into the database if they are not found
        public Team pushTeam(Team Team)
        {
            Team DBTeam = Teams.Find(Team.Name);

            if (DBTeam == null)
            {
                Teams.Add(Team);
                return Team;
            }
            else
            {
                return DBTeam;
            }
        }
Example #3
0
 public ActionResult Edit(Team team)
 {
     if (ModelState.IsValid)
     {
         db.Entry(team).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(team);
 }