Пример #1
0
        // GET: Votes/Details/5
        public IActionResult Create(int? id, int? teamid, int? matchid)
        {
            Match match = _context.Match.Single(m => m.MatchId == matchid);
            Vote vote = new Vote();
            vote.Match = match;
            string userId = User.GetUserId();
            vote.user = _context.Users.Single(u => u.Id == userId);
            Team team = _context.Team.Single(s => s.TeamId == teamid);
            vote.VotedTeam = team;
            _context.Vote.Add(vote);
            _context.SaveChanges();

            return RedirectToAction("Index");
        }
Пример #2
0
 public IActionResult Editasd(Vote vote)
 {
     if (ModelState.IsValid)
     {
         _context.Update(vote);
         _context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(vote);
 }