예제 #1
0
        public async Task Vote(CardSubmission CSub)
        {
            // int? loggeduserId = HttpContext.Session.GetInt32("currentuser");

            // if(CSub.UserId == (int)HttpContext.Session.GetInt32("currentuser"))
            int index = Submissions.IndexOf(Submissions.Where(x => x.UserId == CSub.UserId).FirstOrDefault());

            // System.Console.WriteLine(index);
            Submissions[index].VoteCount += 1;
            await Clients.All.SendAsync("ReceiveMessage", Submissions);
        }
예제 #2
0
        public async Task SendMessage(string verb, string msg, string str1, string str2, string str3, int userId, string Username)
        {
            string         encodedMsg    = str1 + " " + verb + " " + str2 + " " + msg + " " + str3;
            CardSubmission newSubmission = new CardSubmission()
            {
                EncodedMsg = encodedMsg,
                UserId     = userId,
                Username   = Username
            };

            ChatHub.Submissions.Add(newSubmission);
            await Clients.All.SendAsync("ReceiveMessage", Submissions);
        }