Exemplo n.º 1
0
        public IActionResult AddComment(string to, string commenter, string commentText, string cheer)
        {
            User toUser   = repo.GetUserByEmail(to);
            User fromUser = repo.GetUserByEmail(commenter);

            ViewBag.ToUser   = toUser.Email;
            ViewBag.FromUser = fromUser.Email;

            //Get Cheer value
            bool bCheer = false;

            if (cheer == "cheer")
            {
                bCheer = true;
            }

            repo.AddComment(
                new Comment
            {
                FromName  = fromUser.Name,
                FromEmail = fromUser.Email,
                TimeStamp = DateTime.Now,
                Text      = commentText,
                Cheer     = bCheer
            },
                toUser);



            return(RedirectToAction("LeaderBoard", toUser));
        }