Exemplo n.º 1
0
        /// <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();
        }
Exemplo n.º 2
0
        /// <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();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Loads users.
 /// </summary>
 public static void LoadUsers()
 {
     UsersDatabase.LoadUsers();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets loged in user.
 /// </summary>
 /// <returns>Loged user.</returns>
 public static User GetLogedInUser()
 {
     return(UsersDatabase.GetLogedInUser());
 }
Exemplo n.º 5
0
 /// <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));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets users.
 /// </summary>
 /// <returns>IEnumerable of the users.</returns>
 public static IEnumerable <User> GetUsers()
 {
     return(UsersDatabase.GetUsers());
 }
Exemplo n.º 7
0
 /// <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));
 }