Пример #1
0
        public UserData CreateUser(UserData data, string token)
        {
            AuthenticationHelper.ValidateToken(token);

            data.UserId = MockDb.NextId;

            data.Salt = CryptographyHelper.GetSalt(20);
            data.Password = CryptographyHelper.Salt(data.Salt, data.Password);

            MockDb.Users.Add(data);

            return data;
        }
Пример #2
0
        public UserData UpdateUser(UserData data, string token)
        {
            AuthenticationHelper.ValidateToken(token);

            var user = MockDb.Users.Single(row => row.UserId == data.UserId);

            user.Name = data.Name;

            return user;
        }