Esempio n. 1
0
        // GET: Bracket
        public ActionResult Index()
        {
            var service = new BracketService();
            var model   = service.GetBrackets();

            return(View(model));
        }
Esempio n. 2
0
        //GET: Bracket Edit
        public ActionResult Edit(int id)
        {
            var db            = new BracketService();
            var detail        = db.GetBracketById(id);
            var characterList = new SelectList(db.Characters(), "CharacterId", "CharacterName");

            ViewBag.FirstCharacterId   = characterList;
            ViewBag.SecondCharacterId  = characterList;
            ViewBag.ThirdCharacterId   = characterList;
            ViewBag.FourthCharacterId  = characterList;
            ViewBag.FifthCharacterId   = characterList;
            ViewBag.SixthCharacterId   = characterList;
            ViewBag.SeventhCharacterId = characterList;
            ViewBag.EighthCharacterId  = characterList;

            var model =
                new BracketEdit
            {
                BracketId          = detail.BracketId,
                Location           = detail.Location,
                TournamentName     = detail.TournamentName,
                FirstCharacterId   = detail.FirstCharacterEightId,
                SecondCharacterId  = detail.SecondCharacterEightId,
                ThirdCharacterId   = detail.ThirdCharacterEightId,
                FourthCharacterId  = detail.FourthCharacterEightId,
                FifthCharacterId   = detail.FifthCharacterEightId,
                SixthCharacterId   = detail.SixthCharacterEightId,
                SeventhCharacterId = detail.SeventhCharacterEightId,
                EighthCharacterId  = detail.EighthCharacterEightId,
            };

            return(View(model));
        }
Esempio n. 3
0
        //GET: Battle Delete
        public ActionResult Delete(int id)
        {
            var svc   = new BracketService();
            var model = svc.GetBracketById(id);

            return(View(model));
        }
Esempio n. 4
0
 public BracketController(
     IRequestFieldExtractor extractor,
     IBracketClient bracketClient)
 {
     requestFieldExtractor = extractor;
     bracketService        = new BracketService(bracketClient);
 }
Esempio n. 5
0
        public ActionResult DeletePost(int id)
        {
            var service = new BracketService();

            service.DeleteBracket(id);

            TempData["SaveResult"] = "Your Bracket was deleted. You must've not liked the outcome.";
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
        //POST: Bracket Details
        public ActionResult Details(int id)
        {
            var svc   = new BracketService();
            var model = svc.GetBracketById(id);

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            return(View(model));
        }
Esempio n. 7
0
        public ActionResult Create(BracketCreate model)
        {
            var svc = new BracketService();

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (svc.CreateBracket(model))
            {
                TempData["SaveResult"] = "Your Bracket is set! May the best character win!";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Bracket was unable to be created, please try again");

            return(View(model));
        }
Esempio n. 8
0
        //GET: Create Bracket
        public ActionResult Create()
        {
            var service = new BracketService();
            //var characterService = CreateCharacterService();
            //if (!ModelState.IsValid)
            //{
            //    return RedirectToAction("Register", "Account");
            //}
            var characterList = new SelectList(service.Characters(), "CharacterId", "CharacterName");

            ViewBag.FirstCharacterEightId   = characterList;
            ViewBag.SecondCharacterEightId  = characterList;
            ViewBag.ThirdCharacterEightId   = characterList;
            ViewBag.FourthCharacterEightId  = characterList;
            ViewBag.FifthCharacterEightId   = characterList;
            ViewBag.SixthCharacterEightId   = characterList;
            ViewBag.SeventhCharacterEightId = characterList;
            ViewBag.EighthCharacterEightId  = characterList;

            return(View());
        }
Esempio n. 9
0
        public ActionResult Edit(int id, BracketEdit model)
        {
            var svc = new BracketService();

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.BracketId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            if (svc.UpdateBracket(model))
            {
                TempData["SaveResult"] = "Your Bracket was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your Bracket could not be updated");
            return(View(model));
        }