/// <summary> /// Marks as complete todos. /// </summary> /// <param name="index">Index of todo.</param> public static void MarkAsComplete(int index) { User logedInUser = GetLogedInUser(); int i = 0; foreach (var item in logedInUser.TodoList) { if (item.IsCompleted == false) { if (i == index) { item.IsCompleted = true; break; } else { i++; } } } UsersDatabase.UpdateDatabase(); }
/// <summary> /// Removes todo. /// </summary> /// <param name="indexOfToDoInt">Index of todo.</param> public static void RemoveToDo(int indexOfToDoInt) { User logedInUser = GetLogedInUser(); int j = 0; for (int i = 0; i < logedInUser.TodoList.Count; i++) { if (!logedInUser.TodoList[i].IsCompleted) { if (j == indexOfToDoInt) { logedInUser.TodoList.RemoveAt(i); break; } else { j++; } } } UsersDatabase.UpdateDatabase(); }
/// <summary> /// Loads users. /// </summary> public static void LoadUsers() { UsersDatabase.LoadUsers(); }
/// <summary> /// Gets loged in user. /// </summary> /// <returns>Loged user.</returns> public static User GetLogedInUser() { return(UsersDatabase.GetLogedInUser()); }
/// <summary> /// User login. /// </summary> /// <param name="email">Email.</param> /// <param name="password">Password.</param> /// <returns>True if there is existing user.</returns> public static bool LogInUser(string email, string password) { return(UsersDatabase.LoginUser(email, password)); }
/// <summary> /// Gets users. /// </summary> /// <returns>IEnumerable of the users.</returns> public static IEnumerable <User> GetUsers() { return(UsersDatabase.GetUsers()); }
/// <summary> /// Adds user. /// </summary> /// <param name="user">User.</param> /// <returns>True if there is no user with the same input.</returns> public static bool AddUser(User user) { return(UsersDatabase.AddUser(user)); }