Пример #1
0
        private static void EditUserProfile(ClientInfo clientInfo, JObject jsonObject)
        {
            var userIdToken   = jsonObject["userId"];
            var nameToken     = jsonObject["name"];
            var passwordToken = jsonObject["password"];
            var emailToken    = jsonObject["email"];
            var avatarToken   = jsonObject["avatar"];
            var amountToken   = jsonObject["amount"];

            if (userIdToken == null || userIdToken.Type != JTokenType.Integer)
            {
                throw new ArgumentException("User Id Error: Parameters Mismatch at Edit User Profile");
            }

            if ((avatarToken == null) || (avatarToken.Type != JTokenType.String) ||
                ((((byte[])avatarToken).Length) == 0))
            {
                throw new ArgumentException("Picture Error: Parameters Mismatch at Edit User Profile");
            }

            var editUserProfileResponse = sl.editUserProfile(
                (int)userIdToken,
                (string)nameToken,
                (string)passwordToken,
                (string)emailToken,
                (Bitmap)((new ImageConverter()).ConvertFrom((byte[])avatarToken)),
                (int)amountToken);


            SendMessage(clientInfo, editUserProfileResponse);
            return;
        }
        public void successEditUserTest()
        {
            object obj = sl.editUserProfile(db.getUserByName("test0").id, "Hadas123", "12345", "email7", null, 100);

            Assert.IsInstanceOfType(obj, typeof(ReturnMessage));
            Assert.IsTrue(((ReturnMessage)obj).success);
            sl.editUserProfile(db.getUserByName("Hadas123").id, "test0", "12345", "email7", null, 100);
        }
Пример #3
0
 public object editProfile(int userId, string username, string password, string email, Image picture, int moneyAmount)
 {
     return(sl.editUserProfile(userId, username, password, email, picture, moneyAmount));
 }