Пример #1
0
        async void DoPostCommand()
        {
            if (CircleID != Constants.NoSelection)
            {
                try
                {
                    Post toAdd = new Post {
                        text = NewPost, user_id = UserID, circle_id = CircleID, created_at = DateTime.UtcNow, updated_at = DateTime.UtcNow
                    };
                    await _mLearningService.CreateObject <Post>(toAdd, p => p.id);

                    NewPost = "";

                    post_with_username puser = new post_with_username(toAdd);
                    puser.username = SessionService.GetUsername();

                    PostsList.Add(new post_with_username_wrapper {
                        post = puser, userImage = UserImage
                    });
                }
                catch (WebException e)
                {
                    ConnectionOK = false;
                }
            }
            else
            {
                //Notify Invalid Operation

                OperationOK = false;
            }
        }
Пример #2
0
        async void DoAddPublisherCommand()
        {
            var user = new User {
                name = FirstName, lastname = LastName, username = Username, password = EncryptionService.encrypt(Password), email = Email
            };
            OperationResult r = await _mLearningService.CreateAccount <User>(user, u => u.id, UserType.Publisher);

            _mLearningService.CreateObject <Institution_has_User>(new Institution_has_User {
                institution_id = Institution_id, user_id = r.id, created_at = DateTime.UtcNow, updated_at = DateTime.UtcNow
            }, ins => ins.id);

            Close(this);
        }
Пример #3
0
        async void DoCreateCircleCommand()
        {
            int circle_id = await _mLearningService.CreateCircle(UserID, CircleName, CircleType);


            var circle = new circle_by_user {
                id = circle_id, name = CircleName, type = CircleType
            };

            CirclesList.Add(circle);

            //Register the Publisher as a user in a Circle
            _mLearningService.CreateObject <CircleUser>(new CircleUser {
                Circle_id = circle_id, User_id = UserID, created_at = DateTime.UtcNow, updated_at = DateTime.UtcNow
            }, c => c.id);
        }