예제 #1
0
        public async void Accept(string userId)
        {
            User user = db.Users.FirstOrDefault(u => u.UserId.ToString() == userId);

            if (user != null)
            {
                user.IsVerified = true;
                db.SaveChanges();
            }

            await Clients.Caller.SendAsync("Delete", userId);
        }
예제 #2
0
        public async Task Message(string userName, string message, string groupName)
        {
            await Clients.Group(groupName).SendAsync("Message", userName, message);

            db.Messages.Add(new Message()
            {
                AuthorId = int.Parse(Context.User.Identity.Name),
                Text     = message
            });
            db.SaveChanges();
        }