Esempio n. 1
0
        public async Task <ActionResult> DeleteMember(int id)
        {
            TeamGeek tgsuppr = db.TeamGeek.Where(tg => tg.Player == id).FirstOrDefault();

            tgsuppr.Deleted = true;
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            TeamGeek teamGeek = await db.TeamGeek.FindAsync(id);

            teamGeek.Deleted = true;
            //db.TeamGeek.Remove(teamGeek);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "Teams/Details/" + teamGeek.Team));
        }
Esempio n. 3
0
        public async Task <ActionResult> Edit([Bind(Include = "TeamGeekId,Player,Team,Deleted")] TeamGeek teamGeek)
        {
            if (ModelState.IsValid)
            {
                db.Entry(teamGeek).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Player = new SelectList(db.Geek, "GeekId", "Username", teamGeek.Player);
            ViewBag.Team   = new SelectList(db.Team, "TeamId", "Initials", teamGeek.Team);
            return(View(teamGeek));
        }
Esempio n. 4
0
        // GET: TeamGeeks/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TeamGeek teamGeek = await db.TeamGeek.FindAsync(id);

            if (teamGeek == null)
            {
                return(HttpNotFound());
            }
            return(View(teamGeek));
        }
Esempio n. 5
0
        // GET: TeamGeeks/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TeamGeek teamGeek = await db.TeamGeek.FindAsync(id);

            if (teamGeek == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Player = new SelectList(db.Geek, "GeekId", "Username", teamGeek.Player);
            ViewBag.Team   = new SelectList(db.Team, "TeamId", "Initials", teamGeek.Team);
            return(View(teamGeek));
        }
Esempio n. 6
0
        public async Task <ActionResult> Create([Bind(Include = "TeamId,Initials,Name,Tags,Captain,Deleted")] Team team)
        {
            if (ModelState.IsValid)
            {
                Geek capitaine = db.Geek.Where(g => g.Username == User.Identity.Name).FirstOrDefault();
                team.Captain = capitaine.GeekId;
                TeamGeek tg = new TeamGeek();
                tg.Player = capitaine.GeekId;
                tg.Team   = team.TeamId;
                db.TeamGeek.Add(tg);
                db.Team.Add(team);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Captain = new SelectList(db.Geek, "GeekId", "Username", team.Captain);
            return(View(team));
        }
Esempio n. 7
0
        public async Task <ActionResult> Create([Bind(Include = "TeamGeekId,Player,Team,Deleted")] TeamGeek teamGeek, int teamID)
        {
            if (ModelState.IsValid)
            {
                //teamGeek.Player = 2;
                Geek geek = db.Geek.Where(g => g.Username == User.Identity.Name).FirstOrDefault();
                teamGeek.Player = geek.GeekId;
                teamGeek.Team   = teamID;
                db.TeamGeek.Add(teamGeek);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", "Teams/Details/" + teamID));
            }

            //ViewBag.Player = new SelectList(db.Geek, "GeekId", "Username", User.Identity);
            //ViewBag.Team = new SelectList(db.Team, "TeamId", "Initials", teamGeek.Team);
            return(View(teamGeek));
        }