예제 #1
0
        public object Execute(object request)
        {
            User[]             arrData      = (User[])request;
            User               user         = arrData[0];
            User               otherUser    = arrData[1];
            List <UserMessage> userMessages = userMessageService.getAllMessageByUserId(user.Id);
            List <Dialog>      dialogs      = dialogService.createDialogs(userMessages, user.Id);

            return(dialogService.getDialogByUsers(dialogs, user, otherUser));
        }
예제 #2
0
        public object Execute(object request)
        {
            List <UserMessage> userMessages = userMessageService.getAllMessageByUserId((int)request);

            foreach (UserMessage u in userMessages)
            {
                Message message = messageService.readById(u.MessageId);
                userMessageService.delete(u);
                messageService.delete(message);
            }
            return(null);
        }
예제 #3
0
        public object Execute(object request)
        {
            using (TestDbContext context = new TestDbContext())
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        User                         user                   = (User)request;
                        List <PlayList>              playLists              = playListService.getAllByUserId(user.Id);
                        List <Comment>               comments               = commentService.getAllByUserId(user.Id);
                        List <UserMessage>           userMessages           = userMessageService.getAllMessageByUserId(user.Id);
                        List <MessageConclusionTime> messageConclusionTimes = messageConclusionTimeService.getAllByUserId(user.Id);
                        foreach (PlayList p in playLists)
                        {
                            playListService.delete(p);
                        }
                        foreach (Comment c in comments)
                        {
                            commentService.delete(c);
                        }
                        foreach (UserMessage u in userMessages)
                        {
                            Message message = messageService.readById(u.MessageId);
                            userMessageService.delete(u);
                            messageService.delete(message);
                        }
                        foreach (MessageConclusionTime m in messageConclusionTimes)
                        {
                            messageConclusionTimeService.delete(m);
                        }

                        userService.delete(user);
                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                    }
                }
            }
            return(null);
        }
예제 #4
0
        public object Execute(object request)
        {
            List <UserMessage> userMessages = userMessageService.getAllMessageByUserId((int)request);

            return(dialogService.createDialogs(userMessages, (int)request));
        }