Пример #1
0
        public async Task ResetPassword(User user, string newPassword)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(newPassword, out passwordHash, out passwordSalt);

            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;

            await _userDataContext.Update(user);
        }
 public async Task <bool> Update <T>(T entity) where T : class
 {
     if (typeof(T) == typeof(User))
     {
         return(await _userDataContext.Update(entity as User));
     }
     else if (typeof(T) == typeof(Like))
     {
         return(await _likesDataContext.Update(entity as Like));
     }
     else if (typeof(T) == typeof(Photo))
     {
         return(await _photosDataContext.Update(entity as Photo));
     }
     else if (typeof(T) == typeof(Message))
     {
         return(await _messagesDataContext.Update(entity as Message));
     }
     else
     {
         throw new NotImplementedException();
     }
 }