Exemple #1
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Places,PayForPlace")] Stadium stadium)
        {
            if (ModelState.IsValid)
            {
                await StadiumService.sharedInstance().UpdateStadiums(stadium);

                return(RedirectToAction("Index"));
            }
            return(View(stadium));
        }
        // GET: Games/Create
        public async Task <ActionResult> Create()
        {
            var stadiums = await StadiumService.sharedInstance().GetStadiums();

            var teams = await TeamService.sharedInstance().getTeams();

            ViewBag.StadiumId    = new SelectList(stadiums, "Id", "Id");
            ViewBag.FirstTeamId  = new SelectList(teams, "Id", "TeamName");
            ViewBag.SecondTeamId = new SelectList(teams, "Id", "TeamName");
            return(View());
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,StadiumId,FirstTeamId,SecondTeamId,Result,Audience,GameDate")] Game game)
        {
            if (ModelState.IsValid)
            {
                await GameService.sharedInstance().addGame(game);

                return(RedirectToAction("Index"));
            }
            var stadiums = await StadiumService.sharedInstance().GetStadiums();

            ViewBag.StadiumId = new SelectList(stadiums, "Id", "Id", game.StadiumId);
            return(View(game));
        }
Exemple #4
0
        // GET: Stadium/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Stadium stadium = await StadiumService.sharedInstance().GetStadium((int)id);

            if (stadium == null)
            {
                return(HttpNotFound());
            }
            return(View(stadium));
        }
        // GET: Games/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Game game = await GameService.sharedInstance().getGame((int)id);

            if (game == null)
            {
                return(HttpNotFound());
            }
            var stadiums = await StadiumService.sharedInstance().GetStadiums();

            var teams = await TeamService.sharedInstance().getTeams();

            ViewBag.StadiumId    = new SelectList(stadiums, "Id", "Id");
            ViewBag.FirstTeamId  = new SelectList(teams, "Id", "TeamName");
            ViewBag.SecondTeamId = new SelectList(teams, "Id", "TeamName");
            return(View(game));
        }
Exemple #6
0
        // GET: Stadium
        public async Task <ActionResult> Index()
        {
            var stadiums = await StadiumService.sharedInstance().GetStadiums();

            return(View(stadiums));
        }
Exemple #7
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            await StadiumService.sharedInstance().DeleteStadium(id);

            return(RedirectToAction("Index"));
        }