/// <summary> /// Check if user with given credentials exists /// </summary> public bool CheckUser(AppDbContext context, out UserEntity user) { user = null; var passwordHash = Password.ComputeHashMD5(); user = context.Users .Where(u => u.Phone == Phone && u.PasswordHash == passwordHash) .SingleOrDefault(); return(user != null); }