public static void Login_Start(User user, Password password) { if (password == Password.Correct) activeLoginRequests = activeLoginRequests.Add(user, LoginStatus.Success); else activeLoginRequests = activeLoginRequests.Add(user, LoginStatus.Failure); }
public static void Login_Finish(User user, LoginStatus status) { if (status == LoginStatus.Success) { Contract.usersLoggedIn = Contract.usersLoggedIn.Add(user); } else // if status == LoginStatus.Failure if (Contract.usersLoggedIn.Contains(user)) Contract.usersLoggedIn = Contract.usersLoggedIn.Remove(user); activeLoginRequests = activeLoginRequests.RemoveKey(user); }
public static bool LogoutEnabled(User user) { return Contract.usersLoggedIn.Contains(user); }
public static void Logout(User user) { Contract.usersLoggedIn = Contract.usersLoggedIn.Remove(user); }
public static bool Login_StartEnabled(User user) { return !activeLoginRequests.ContainsKey(user) && !Contract.usersLoggedIn.Contains(user); }
public static bool Login_FinishEnabled(User user, LoginStatus status) { return activeLoginRequests.Keys.Contains(user) && activeLoginRequests[user].Equals(status); }
public static void UpdateInt(User user, [Domain("numbers")] int number) { userToInt = userToInt.Override(user,number); }
public static bool ReadIntEnabled(User user, int number) { return userToInt[user] == number; }
public static void ReadInt(User user,[Domain("numbers")] int number) { // Reading a number from the page should not change the state // thus the body is empty. }