Exemplo n.º 1
0
        static void Main()
        {
            UserRespository userRepo = new UserRespository();


            User newUser = new User();

            newUser.Email    = "luis.email.com";
            newUser.UserId   = 1;
            newUser.UserName = "******";

            User newUser2 = new User();

            newUser2.Email    = "myra.email.com";
            newUser2.UserId   = 2;
            newUser2.UserName = "******";

            User newUser3 = new User();

            newUser3.Email    = "Luis.email.com";
            newUser3.UserId   = 3;
            newUser3.UserName = "******";

            userRepo.Save(newUser);
            userRepo.Save(newUser2);
            userRepo.Save(newUser3);

            userRepo.GetAllUsersByName("2");
        }
Exemplo n.º 2
0
        static void Main()
        {
           
            string path = "Test Directory";
            string moveToPath = "../../TestDirectory";



            File.CreateText(path);

            FileManagerClass newManager = new FileManagerClass();
            newManager.CreateAFile(path);
            newManager.MoveFile(path, moveToPath);

            newManager.CreateDirectory(path);
            newManager.MoveDirectory(path, moveToPath);

            UserRespository userRepo = new UserRespository();


            User newUser = new User();
            newUser.Email = "luis.email.com";
            newUser.UserId = 1;
            newUser.UserName = "******";

            User newUser2 = new User();
            newUser2.Email = "myra.email.com";
            newUser2.UserId = 2;
            newUser2.UserName = "******";

            User newUser3 = new User();
            newUser3.Email = "Luis.email.com";
            newUser3.UserId = 3;
            newUser3.UserName = "******";

            userRepo.Save(newUser);
            userRepo.Save(newUser2);
            userRepo.Save(newUser3);

            userRepo.GetAllUsersByName("2");

        }
Exemplo n.º 3
0
        static void Main()
        {
            try
            {
                ShoppingCart myShoppingCart = new ShoppingCart();

                myShoppingCart.ExecuteMainMenu();
            }
            catch (ShoppingCartException exception)
            {
                Console.WriteLine(exception.Message);
            }
            string response = "";

            while (response != "5")
            {
                List <User>     userList    = new List <User>();
                List <Comment>  commentList = new List <Comment>();
                UserRespository userRepo    = new UserRespository();
                UserRespository userComment = new UserRespository();

                Console.WriteLine("1. Create User");
                Console.WriteLine("2. Create a Comment");
                Console.WriteLine("3. Print List of Users");
                Console.WriteLine("4. Print List of Comments");
                Console.WriteLine("5. Look for a User");
                Console.WriteLine("6. Look for a Comment");
                Console.WriteLine("7. Create a Data File");

                Console.WriteLine("8. Exit the Program");

                Console.WriteLine("");
                Console.WriteLine("Please select an option: ");
                Console.ReadLine();

                response = Console.ReadLine();

                switch (response)
                {
                case "1":
                    User user = new User();
                    user.UserName = "******";

                    User user2 = new User();
                    user2.UserName = "******";
                    userList.Add(user2);

                    User user3 = new User();
                    user3.UserName = "******";

                    Console.WriteLine("You have created a user");
                    break;

                case "2":
                    Comment hisComment = new Comment();
                    hisComment.TheBestComment = "The best is yet to Come!";
                    commentList.Add(hisComment);
                    Console.WriteLine("You have created a comment");
                    break;

                case "3":
                    Console.WriteLine("This is the list you wanted: ");
                    foreach (var insideUser in userList)
                    {
                        Console.WriteLine(insideUser.UserId);
                        Console.WriteLine(insideUser.UserName);
                    }
                    break;

                case "4":
                    Console.WriteLine("This is the list you wanted: ");
                    foreach (var insideComment in commentList)
                    {
                        Console.WriteLine(insideComment.CommentId);
                        Console.WriteLine(insideComment.TheBestComment);
                    }
                    break;

                case "5":
                    userRepo.GetAllUsersByName(UserName);
                    break;

                case "6":
                    userComment.GetAllComments(commentList);
                    break;
                }
            }
        }