Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            MhclTeam mhclTeam = db.MhclTeam.Find(id);

            db.MhclTeam.Remove(mhclTeam);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "TeamId,TeamName,TeamOwnerName,TeamCreateTime,TeamUpdateTime")] MhclTeam mhclTeam)
        {
            if (ModelState.IsValid)
            {
                mhclTeam.TeamCreateTime = DateTime.Now;
                mhclTeam.TeamUpdateTime = DateTime.Now;
                db.MhclTeam.Add(mhclTeam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mhclTeam));
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "TeamId,TeamName,TeamOwnerName,TeamCreateTime,TeamUpdateTime")] MhclTeam mhclTeam)
        {
            if (ModelState.IsValid)
            {
                mhclTeam.TeamUpdateTime  = DateTime.Now;
                db.Entry(mhclTeam).State = EntityState.Modified;
                db.SaveChanges();

                Thread.Sleep(5000);

                return(RedirectToAction("Index"));
            }
            return(View(mhclTeam));
        }
Exemplo n.º 4
0
        // GET: MhclTeams/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MhclTeam mhclTeam = db.MhclTeam.Find(id);

            if (mhclTeam == null)
            {
                return(HttpNotFound());
            }
            return(View(mhclTeam));
        }
Exemplo n.º 5
0
        public ActionResult AllocatePlayer(FormCollection formData)
        {
            int currPlayerId = Convert.ToInt32(TempData["CurrentPlayerId"]);

            TempData.Keep();
            MhclPlayer      currPlayer     = db.MhclPlayer.Find(currPlayerId);
            List <MhclTeam> allTeams       = db.MhclTeam.ToList();
            MhclTeam        teamToAllocate = allTeams.Where(t => t.TeamName == formData[1]).FirstOrDefault();
            List <MhclTeam> playerTeams    = new List <MhclTeam>();

            playerTeams.Add(teamToAllocate);

            currPlayer.PurchasePrice = Convert.ToInt32(formData[0]);
            currPlayer.MhclTeam      = playerTeams;

            db.Entry(currPlayer).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }