예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,ClubsNumber")] EuroCup euroCup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(euroCup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(euroCup));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,ClubsNumber,Name")] League league)
        {
            if (ModelState.IsValid)
            {
                _context.Add(league);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(league));
        }
        public async Task <IActionResult> Create([Bind("Id,Rank,Player,Team,Position,Age,Gamesplayed,Passescompleted,Fantasypoints,Pprscoring,Posrank,Week1,Week2,Week3,Week4,Week5,Week6,Week7,Week8,Week9,Week10,Week11,Week12,Week13,Week14,Week15,Week16,Week17")] Playersstatistics playersstatistics)
        {
            if (ModelState.IsValid)
            {
                _context.Add(playersstatistics);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(playersstatistics));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("DataProvedeniya,Result,CommandID,MatchID")] Match match)
        {
            if (ModelState.IsValid)
            {
                _context.Add(match);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(match));
        }
예제 #5
0
        public async Task <IActionResult> Create([Bind("ID,Name")] Championship championship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(championship);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(championship));
        }
예제 #6
0
        public async Task <IActionResult> Create([Bind("TeamId,Name,League")] Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Create(Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.teams, "TeamId", "TeamId", player.TeamId);
            return(View(player));
        }
예제 #8
0
        public async Task <IActionResult> Create([Bind("PlayerId,FirstName,LastName,ShirtNumber,TeamId")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Team, "TeamId", "TeamId", player.TeamId);
            return(View(player));
        }
예제 #9
0
        public async Task <IActionResult> Create([Bind("ChampionshipCommandID,ChampionshipID,CommandID")] ChampionshipCommand championshipCommand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(championshipCommand);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChampionshipID"] = new SelectList(_context.Championships, "ID", "ID", championshipCommand.ChampionshipID);
            ViewData["CommandID"]      = new SelectList(_context.Commands, "CommandID", "CommandID", championshipCommand.CommandID);
            return(View(championshipCommand));
        }
예제 #10
0
        public async Task <IActionResult> Create([Bind("Id,Name,Sourname,Position,NationalId,ClubId,GoalsNumber,AssistsNumber,DateOfBirth,MatchesNumber")] Footboller footboller)
        {
            if (ModelState.IsValid)
            {
                _context.Add(footboller);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClubId"]     = new SelectList(_context.Clubs, "Id", "Name", footboller.ClubId);
            ViewData["NationalId"] = new SelectList(_context.Nationals, "Id", "Name", footboller.NationalId);
            return(View(footboller));
        }
예제 #11
0
        public async Task <IActionResult> Create([Bind("PlayerId,SponsorId")] PlayerSponsor playerSponsor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(playerSponsor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerId"]  = new SelectList(_context.Player, "PlayerId", "PlayerId", playerSponsor.PlayerId);
            ViewData["SponsorId"] = new SelectList(_context.Sponsor, "SponsorId", "SponsorId", playerSponsor.SponsorId);
            return(View(playerSponsor));
        }
예제 #12
0
        public async Task <IActionResult> Create([Bind("Id,Name,PlayersNumber,DateOfBirth,TrophiesNumber,NationalId,PositionInLeague,CupId,LeagueId,EuroCupId")] Club club)
        {
            if (ModelState.IsValid)
            {
                _context.Add(club);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CupId"]      = new SelectList(_context.Cups, "Id", "Name", club.CupId);
            ViewData["EuroCupId"]  = new SelectList(_context.EuroCups, "Id", "Name", club.EuroCupId);
            ViewData["LeagueId"]   = new SelectList(_context.Leagues, "Id", "Name", club.LeagueId);
            ViewData["NationalId"] = new SelectList(_context.Nationals, "Id", "Name", club.NationalId);
            return(View(club));
        }
        public async Task <IActionResult> Create(int nationalCupId, [Bind("Id,Name,TrophiesNumber,NationalCupId")] National national)
        {
            national.NationalCupId = nationalCupId;
            if (ModelState.IsValid)
            {
                _context.Add(national);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Nationals", new { id = nationalCupId, name = _context.NationalCups.Where(m => m.Id == nationalCupId).FirstOrDefault().Name }));
            }
            ViewData["NationalCupId"] = new SelectList(_context.NationalCups, "Id", "Name", national.NationalCupId);
            // return View(national);
            return(RedirectToAction("Index", "Nationals", new { id = nationalCupId, name = _context.NationalCups.Where(m => m.Id == nationalCupId).FirstOrDefault().Name }));
        }
예제 #14
0
        public async Task <IActionResult> Create([Bind("LastName,FirstMidName,SigningDate")] Player player)
        {
            try {
                if (ModelState.IsValid)
                {
                    _context.Add(player);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(player));
        }
예제 #15
0
 public void Add(TEntity item)
 {
     _context.Add(item);
 }