public void Vote(Vote newVote)
        {
            if (string.IsNullOrEmpty(newVote.restaurant))
            {
                throw new Exception("Restaurante inválido!");
            }

            ISingleton instSingle = SingletonTXT.getInstance();

            if (!string.IsNullOrEmpty(instSingle.UsersVotedOnDay(newVote.date).Find(element => element.Contains(newVote.login))))
            {
                throw new Exception("Usuário já votou neste dia!");
            }

            instSingle.InsertVote(newVote);
        }
        public User CreateUser(string name, string login, string pass)
        {
            ISingleton instSingle = SingletonTXT.getInstance();

            if (name != "" && login != "" && pass != "")
            {
                if (instSingle.FindLogin(login) != null)
                {
                    throw new Exception("Login já existente");
                }
                else
                {
                    User newUser = new User(name, login, pass);
                    instSingle.CreateUser(newUser);
                    return(newUser);
                }
            }
            throw new Exception("Entrada Inválida");
        }
        public Dictionary <string, int> VotesOfDay(DateTime date)
        {
            ISingleton instSingle = SingletonTXT.getInstance();
            Dictionary <string, int> countVotes = new Dictionary <string, int>();
            List <string>            votes      = instSingle.VotesOfDay(date);

            foreach (string element in votes.Distinct())
            {
                int cont = 0;
                foreach (string iterator in votes)
                {
                    if (string.Equals(element, iterator))
                    {
                        cont++;
                    }
                }
                countVotes.Add(element, cont);
            }
            return(countVotes);
        }
        public User ExecuteLogin(string login, string pass)
        {
            ISingleton instSingle = SingletonTXT.getInstance();
            User       user       = instSingle.FindLogin(login);

            //Console.Write(user.getPass().Equals(pass).ToString());

            if (user == null)
            {
                Console.WriteLine("É NULOOO");
            }

            if (user != null && user.getPass().Equals(pass))
            {
                return(user);
            }
            else
            {
                throw new Exception("´Login ou Senha inválidos");
            }
        }
        public List <string> GetAllRestaurant()
        {
            ISingleton instSingle = SingletonTXT.getInstance();

            return(instSingle.AllRestaurant());
        }