예제 #1
0
        public UserData AddUserData(UserData model)
        {
            _context.Add(model);
            _context.SaveChanges();

            return(model);
        }
예제 #2
0
        public GroupUser AddGroupUser(GroupUser groupUser)
        {
            _context.Add(groupUser);
            _context.SaveChanges();

            return(groupUser);
        }
예제 #3
0
        public Comment AddComment(Comment comment)
        {
            _context.Add(comment);
            _context.SaveChanges();

            return(comment);
        }
예제 #4
0
        public async Task SendMessage(string text, string connectionid, string url, string senderName)
        {
            var httpContext = this.Context.GetHttpContext();

            var token     = httpContext.Request.Cookies["user-token"];
            var myprofile = _profileRepository.GetUserByToken(token);

            var recipient = _context.Users.FirstOrDefault(u => u.ConectionId == connectionid);

            Notification notification = new Notification
            {
                IsRead     = false,
                Url        = url,
                SenderName = senderName,
                SendDate   = DateTime.Now,
                UserId     = recipient.Id,
                Text       = text
            };

            _context.Add(notification);
            _context.SaveChanges();

            await Clients.Client(connectionid).SendAsync("RecieveMessage", text, url, senderName);
        }
예제 #5
0
 public void AddCommentReaction(CommentReaction commentReaction)
 {
     _context.Add(commentReaction);
     _context.SaveChanges();
 }