Exemple #1
0
        public IActionResult AddReaction(Reaction r)
        {
            string username = HttpContext.Session.GetString("Account");

            if (username != null)
            {
                try
                {
                    r.User = userRepo.GetUser(username);
                    repo.AddReaction(r);

                    return(RedirectToRoute("competition", new { action = "Details", id = r.Competition_id }));
                }
                catch (Exception)
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "User"));
            }
        }