Example #1
0
        static void AssignChoreToRoommate(ChoreRepository choreRepo, RoommateRepository roommateRepo)
        {
            List <Chore>    chores    = choreRepo.GetAll();
            List <Roommate> roommates = roommateRepo.GetAll();

            foreach (Chore c in chores)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }
            Console.Write("Select chore: ");
            int choreChoice = int.Parse(Console.ReadLine());

            foreach (Roommate r in roommates)
            {
                Console.WriteLine($"{r.Id} - {r.FirstName}");
            }
            Console.Write("Select roommate: ");
            int roommateChoice = int.Parse(Console.ReadLine());

            choreRepo.AssignChore(choreChoice, roommateChoice);

            Chore    chore    = choreRepo.GetById(choreChoice);
            Roommate roommate = roommateRepo.GetById(roommateChoice);

            Console.WriteLine($"{chore.Name} has been assigned to {roommate.FirstName}");
            Console.Write("Press any key to continue");
            Console.ReadKey();
        }
Example #2
0
        static void EditChore(ChoreRepository choreRepo)
        {
            List <Chore> allChores = choreRepo.GetAll();

            // Select a chore
            Console.Clear();
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("Assign Chores");
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("-------------");
            Console.WriteLine("\nPlease choose a chore to edit:");
            for (int i = 1; i < allChores.Count + 1; i++)
            {
                Console.WriteLine($"{i}) {allChores[i-1].Name}");
            }
            Console.WriteLine();
            string userSelection  = Console.ReadLine();
            bool   validSelection = int.TryParse(userSelection, out int choreNum);

            while (!validSelection || choreNum < 0 || choreNum > allChores.Count)
            {
                Console.WriteLine("Invalid selection");
                userSelection  = Console.ReadLine();
                validSelection = int.TryParse(userSelection, out choreNum);
            }
            Chore editedChore = allChores[choreNum - 1];

            Console.WriteLine("Please enter a new name for this chore:");
            editedChore.Name = Console.ReadLine();

            choreRepo.Update(editedChore);

            Console.WriteLine($"{editedChore.Name} has been updated.");
        }
Example #3
0
        static void AssignRoommateChore(ChoreRepository choreRepo, RoommateRepository roommateRepo)
        {
            Console.WriteLine("----------------------");
            Console.WriteLine("Chores");
            Console.WriteLine("----------------------");
            List <Chore> chores = choreRepo.GetAll();

            chores.ForEach(c => Console.WriteLine($"{c.Id} - {c.Name}"));
            Console.WriteLine("");
            Console.Write("Enter chore Id: ");
            int choreId = int.Parse(Console.ReadLine());

            List <Roommate> roommates = roommateRepo.GetAll();

            Console.WriteLine("");
            Console.WriteLine("----------------------");
            Console.WriteLine("Roommates");
            Console.WriteLine("----------------------");
            roommates.ForEach(r => Console.WriteLine($"{r.Id} - {r.Firstname}"));
            Console.WriteLine("");
            Console.Write("Enter roommate Id: ");
            int roommateId = int.Parse(Console.ReadLine());

            Chore    selectedChore    = chores.Find(c => c.Id == choreId);
            Roommate selectedRoommate = roommates.Find(r => r.Id == roommateId);

            choreRepo.AssignChore(roommateId, choreId);
            Console.WriteLine($"{selectedRoommate.Firstname} is assign to {selectedChore.Name}");
            ContinueMenu();
        }
Example #4
0
        static void DeleteChore(ChoreRepository choreRepo)
        {
            List <Chore> allChores = choreRepo.GetAll();

            // Select a chore
            Console.Clear();
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("Assign Chores");
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("-------------");
            Console.WriteLine("\nPlease choose a chore to delete:");
            for (int i = 1; i < allChores.Count + 1; i++)
            {
                Console.WriteLine($"{i}) {allChores[i-1].Name}");
            }
            Console.WriteLine();
            string userSelection  = Console.ReadLine();
            bool   validSelection = int.TryParse(userSelection, out int choreNum);

            while (!validSelection || choreNum < 0 || choreNum > allChores.Count)
            {
                Console.WriteLine("Invalid selection");
                userSelection  = Console.ReadLine();
                validSelection = int.TryParse(userSelection, out choreNum);
            }
            Chore deletedChore = allChores[choreNum - 1];

            choreRepo.Delete(deletedChore.Id);

            Console.WriteLine($"{deletedChore.Name} has been removed from the list.");
        }
Example #5
0
        static void ListAllChores()
        {
            ChoreRepository choreRepo = new ChoreRepository(CONNECTION_STRING);
            List <Chore>    chores    = choreRepo.GetAll();

            foreach (Chore c in chores)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }
        }
Example #6
0
        static void ShowAllChores(ChoreRepository choreRepo)
        {
            List <Chore> chores = choreRepo.GetAll();

            foreach (Chore c in chores)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }
            ContinueMenu();
        }
Example #7
0
        static List <Chore> ListAllChores(string name)
        {
            ChoreRepository choreRepo = new ChoreRepository(CONNECTION_STRING);
            List <Chore>    chores    = choreRepo.GetAll();

            foreach (Chore c in chores)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }
            return(chores);
        }
Example #8
0
        static void AssignChore(ChoreRepository choreRepo, RoommateRepository roommateRepo)
        {
            List <Chore>    allChores    = choreRepo.GetAll();
            List <Roommate> allRoommates = roommateRepo.GetAll();

            // Select a chore
            Console.Clear();
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("Assign Chores");
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("-------------");
            Console.WriteLine("\nPlease choose a chore to assign:");
            for (int i = 1; i < allChores.Count + 1; i++)
            {
                Console.WriteLine($"{i}) {allChores[i-1].Name}");
            }
            Console.WriteLine();
            string userSelection  = Console.ReadLine();
            bool   validSelection = int.TryParse(userSelection, out int choreNum);

            while (!validSelection || choreNum < 0 || choreNum > allChores.Count)
            {
                Console.WriteLine("Invalid selection");
                userSelection  = Console.ReadLine();
                validSelection = int.TryParse(userSelection, out choreNum);
            }
            Chore assignedChore = allChores[choreNum - 1];

            // Select a roommate
            Console.Clear();
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("Assign Chores");
            Console.SetCursorPosition((Console.WindowWidth - 13) / 2, Console.CursorTop);
            Console.WriteLine("-------------");
            Console.WriteLine($"\nAssign {assignedChore.Name} to a roommate:");
            for (int i = 1; i < allRoommates.Count + 1; i++)
            {
                Console.WriteLine($"{i}) {allRoommates[i-1].Firstname} {allRoommates[i-1].Lastname}");
            }
            Console.WriteLine();
            userSelection  = Console.ReadLine();
            validSelection = int.TryParse(userSelection, out int roommateNum);
            while (!validSelection || roommateNum < 0 || roommateNum > allRoommates.Count)
            {
                Console.WriteLine("Invalid selection");
                userSelection  = Console.ReadLine();
                validSelection = int.TryParse(userSelection, out roommateNum);
            }
            Roommate assignedRoommate = allRoommates[roommateNum - 1];

            choreRepo.Assign(assignedChore, assignedRoommate);

            Console.WriteLine($"{assignedChore.Name} has been assigned to {assignedRoommate.Firstname}");
        }
Example #9
0
        static void ShowAllChores(ChoreRepository choreRepo)
        {
            List <Chore> chores = choreRepo.GetAll();

            foreach (Chore c in chores)
            {
                Console.WriteLine($"[{c.Id}] {c.Name}");
            }
            Console.Write("Press any key to continue");
            Console.ReadKey();
        }
Example #10
0
        static void DeleteChore(ChoreRepository choreRepo)
        {
            List <Chore> chores = choreRepo.GetAll();

            chores.ForEach(c => Console.WriteLine($"{c.Id} - {c.Name}"));
            Console.Write("Which chore would you like to delete? ");
            int selectedChoreId = int.Parse(Console.ReadLine());

            choreRepo.Delete(selectedChoreId);
            ContinueMenu();
        }
Example #11
0
        static void ListChores()
        {
            ChoreRepository choreRepo = new ChoreRepository(CONNECTION_STRING);
            List <Chore>    AllChores = choreRepo.GetAll();

            Console.WriteLine("------------------ Chore List -------------------");
            Console.WriteLine($"ID\tName");
            foreach (Chore aChor in AllChores)
            {
                Console.WriteLine($"{aChor.Id}\t{aChor.Name}");
            }
        }
Example #12
0
        static void GetAllChores(ChoreRepository choreRepo)
        {
            List <Chore> allChores = choreRepo.GetAll();

            Console.Clear();
            Console.SetCursorPosition((Console.WindowWidth - 10) / 2, Console.CursorTop);
            Console.WriteLine("All Chores");
            Console.SetCursorPosition((Console.WindowWidth - 10) / 2, Console.CursorTop);
            Console.WriteLine("----------");

            foreach (Chore chore in allChores)
            {
                Console.WriteLine($"{chore.Id} {chore.Name}");
            }
        }
Example #13
0
            static void deleteChore(ChoreRepository choreRepo)
            {
                List <Chore> choresAtRisk = choreRepo.GetAll();

                foreach (Chore c in choresAtRisk)
                {
                    Console.WriteLine($"{c.Id} {c.Name}");
                }
                Console.Write("Select a chore to delete: ");
                int choreToDelete = int.Parse(Console.ReadLine());

                choreRepo.Delete(choreToDelete);
                Console.Write("Press any key to continue");
                Console.ReadKey();
            }
Example #14
0
        static void UpdateChore(ChoreRepository choreRepo)
        {
            List <Chore> chores = choreRepo.GetAll();

            chores.ForEach(c => Console.WriteLine($"{c.Id} - {c.Name}"));

            Console.Write("Which chore would you like to update? ");
            int   selectedChoreId = int.Parse(Console.ReadLine());
            Chore selectedChore   = chores.FirstOrDefault(c => c.Id == selectedChoreId);

            Console.Write("New Chore Name: ");
            selectedChore.Name = Console.ReadLine();

            choreRepo.Update(selectedChore);
            Console.WriteLine($"Chore has been successfully updated");
            ContinueMenu();
        }
Example #15
0
            static void updateChore(ChoreRepository choreRepo)
            {
                List <Chore> choresToUpdate = choreRepo.GetAll();

                foreach (Chore c in choresToUpdate)
                {
                    Console.WriteLine($"{c.Id} - {c.Name}");
                }
                Console.Write("Select a chore to update ");
                int choreUpdateId = int.Parse(Console.ReadLine());

                Console.Write("Enter the new name: ");
                string choreUpdateName = Console.ReadLine();

                choreRepo.Update(choreUpdateId, choreUpdateName);
                Console.Write("Press any key to continue");
                Console.ReadKey();
            }
Example #16
0
        private static void DeleteChore(ChoreRepository choreRepo)
        {
            List <Chore> choreOptions = choreRepo.GetAll();

            foreach (Chore c in choreOptions)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }

            Console.Write("Which chore would you like to delete? ");
            int id = int.Parse(Console.ReadLine());

            choreRepo.Delete(id);

            Console.WriteLine($"Chore with id {id} has been deleted");
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
Example #17
0
        private static void UpdateChore(ChoreRepository choreRepo)
        {
            List <Chore> choreOptions = choreRepo.GetAll();

            foreach (Chore c in choreOptions)
            {
                Console.WriteLine($"{c.Id} - {c.Name}");
            }

            Console.Write("Which chore would you like to update? ");
            int   selectedChoreId = int.Parse(Console.ReadLine());
            Chore selectedChore   = choreOptions.FirstOrDefault(c => c.Id == selectedChoreId);

            Console.Write("New Name: ");
            selectedChore.Name = Console.ReadLine();

            choreRepo.Update(selectedChore);

            Console.WriteLine($"Chore has been successfully updated");
            Console.Write("Press any key to continue");
            Console.ReadKey();
        }
Example #18
0
            static void assignChore(ChoreRepository choreRepo, RoommateRepository roommateRepo)
            {
                List <Chore> proposedChores = choreRepo.GetAll();

                foreach (Chore c in proposedChores)
                {
                    Console.WriteLine($"{c.Id} - {c.Name}");
                }
                Console.Write("Select the Id of the chore you want ");
                int chosenChore = int.Parse(Console.ReadLine());

                Console.WriteLine("-------------------------");
                List <Roommate> proposedRoommates = roommateRepo.GetAll();

                foreach (Roommate r in proposedRoommates)
                {
                    Console.WriteLine($"{r.Id}) {r.Firstname} {r.Lastname}");
                }
                Console.Write("Select the Id of the roommate to assign ");
                int chosenRoommate = int.Parse(Console.ReadLine());

                choreRepo.AssignChore(chosenRoommate, chosenChore);
            }
Example #19
0
        static void Main(string[] args)
        {
            RoomRepository     roomRepo     = new RoomRepository(CONNECTION_STRING);
            ChoreRepository    choreRepo    = new ChoreRepository(CONNECTION_STRING);
            RoommateRepository roommateRepo = new RoommateRepository(CONNECTION_STRING);

            bool runProgram = true;

            while (runProgram)
            {
                string selection = GetMenuSelection();

                switch (selection)
                {
                case ("Show all rooms"):
                    List <Room> rooms = roomRepo.GetAll();
                    foreach (Room r in rooms)
                    {
                        Console.WriteLine($"{r.Name} has an Id of {r.Id} and a max occupancy of {r.MaxOccupancy}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for room"):
                    Console.Write("Room Id: ");
                    int id = int.Parse(Console.ReadLine());

                    Room room = roomRepo.GetById(id);

                    Console.WriteLine($"{room.Id} - {room.Name} Max Occupancy({room.MaxOccupancy})");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a room"):
                    Console.Write("Room name: ");
                    string name = Console.ReadLine();

                    Console.Write("Max occupancy: ");
                    int max = int.Parse(Console.ReadLine());

                    Room roomToAdd = new Room()
                    {
                        Name         = name,
                        MaxOccupancy = max
                    };

                    roomRepo.Insert(roomToAdd);

                    Console.WriteLine($"{roomToAdd.Name} has been added and assigned an Id of {roomToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a room"):
                    List <Room> roomOptions = roomRepo.GetAll();
                    foreach (Room r in roomOptions)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }

                    Console.Write("Which room would you like to update? ");
                    int  selectedRoomId = int.Parse(Console.ReadLine());
                    Room selectedRoom   = roomOptions.FirstOrDefault(r => r.Id == selectedRoomId);

                    Console.Write("New Name: ");
                    selectedRoom.Name = Console.ReadLine();

                    Console.Write("New Max Occupancy: ");
                    selectedRoom.MaxOccupancy = int.Parse(Console.ReadLine());

                    roomRepo.Update(selectedRoom);

                    Console.WriteLine($"Room has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Show all chores"):
                    List <Chore> chores = choreRepo.GetAll();
                    foreach (Chore c in chores)
                    {
                        Console.WriteLine($"{c.Name} has an Id of {c.Id}");
                    }
                    ;
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for a chore"):
                    Console.Write("Chore Id: ");
                    int choreId = int.Parse(Console.ReadLine());

                    Chore chore = choreRepo.GetById(choreId);

                    Console.WriteLine($"{chore.Id} - {chore.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a chore"):
                    Console.Write("Chore name: ");
                    string choreName = Console.ReadLine();

                    Chore choreToAdd = new Chore()
                    {
                        Name = choreName,
                    };

                    choreRepo.Insert(choreToAdd);

                    Console.WriteLine($"{choreToAdd.Name} has been added and assigned an Id of {choreToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for roommate"):
                    Console.Write("Roommate Id: ");
                    int roommateId = int.Parse(Console.ReadLine());

                    Roommate roommate = roommateRepo.GetById(roommateId);

                    Console.WriteLine($"{roommate.FirstName} pays {roommate.RentPortion}% of rent to occupy the {roommate.Room.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Show all unassigned chores"):
                    List <Chore> unassignedChores = choreRepo.UnassignedChores();
                    foreach (Chore c in unassignedChores)
                    {
                        Console.WriteLine($"ID: {c.Id} - Chore: {c.Name}");
                    }
                    ;
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Assign chore to roommate"):
                    List <Chore>    choresToAssign   = choreRepo.GetAll();
                    List <Roommate> roomatesToAssign = roommateRepo.GetAll();
                    Console.WriteLine("Chore List:");
                    Console.WriteLine("---------------------");
                    foreach (Chore c in choresToAssign)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.WriteLine("");
                    Console.Write("Which chore would you like to assign: ");
                    int choreChoice = int.Parse(Console.ReadLine());

                    Console.WriteLine("Roommate List:");
                    Console.WriteLine("---------------------");
                    foreach (Roommate r in roomatesToAssign)
                    {
                        Console.WriteLine($"{r.Id} - {r.FirstName} {r.LastName}");
                    }
                    Console.WriteLine("");
                    Console.Write($"Which roommate would you like to assign to chore #{choreChoice}? ");
                    int roommateChoice = int.Parse(Console.ReadLine());

                    choreRepo.AssignChore(roommateChoice, choreChoice);

                    Roommate roomie = roommateRepo.GetById(roommateChoice);
                    Chore    chorie = choreRepo.GetById(choreChoice);

                    Console.WriteLine($"The '{chorie.Name}' chore was assigned to {roomie.FirstName} {roomie.LastName}!");

                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Get Chore Count"):
                    List <ChoreCount> choreCount = choreRepo.GetChoreCounts();
                    foreach (ChoreCount c in choreCount)
                    {
                        Console.WriteLine($"{c.Name}: {c.NumberOfChores}");
                    }
                    ;
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Exit"):
                    runProgram = false;
                    break;
                }
            }
        }
Example #20
0
        static void Main(string[] args)
        {
            RoomRepository  roomRepo  = new RoomRepository(CONNECTION_STRING);
            ChoreRepository choreRepo = new ChoreRepository(CONNECTION_STRING);

            bool runProgram = true;

            while (runProgram)
            {
                string selection = GetMenuSelection();

                switch (selection)
                {
                case ("Show all rooms"):
                    List <Room> rooms = roomRepo.GetAll();
                    foreach (Room r in rooms)
                    {
                        Console.WriteLine($"{r.Name} has an Id of {r.Id} and a max occupancy of {r.MaxOccupancy}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for room"):
                    Console.Write("Room Id: ");
                    int id = int.Parse(Console.ReadLine());

                    Room room = roomRepo.GetById(id);

                    Console.WriteLine($"{room.Id} - {room.Name} Max Occupancy({room.MaxOccupancy})");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a room"):
                    Console.Write("Room name: ");
                    string name = Console.ReadLine();

                    Console.Write("Max occupancy: ");
                    int max = int.Parse(Console.ReadLine());

                    Room roomToAdd = new Room()
                    {
                        Name         = name,
                        MaxOccupancy = max
                    };

                    roomRepo.Insert(roomToAdd);

                    // Print out name of INSERT room - Id that was set by the INSERT method
                    Console.WriteLine($"{roomToAdd.Name} has been added and assigned an Id of {roomToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a chore"):
                    Console.Write("Chore name: ");
                    string choreName = Console.ReadLine();

                    Chore choreToAdd = new Chore()
                    {
                        Name = choreName
                    };

                    choreRepo.Insert(choreToAdd);

                    Console.WriteLine($"{choreToAdd.Name} has been added and assigned an Id of {choreToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a room"):
                    List <Room> roomOptions = roomRepo.GetAll();
                    foreach (Room r in roomOptions)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }

                    Console.Write("Which room would you like to update? ");
                    int  selectedRoomId = int.Parse(Console.ReadLine());
                    Room selectedRoom   = roomOptions.FirstOrDefault(r => r.Id == selectedRoomId);

                    Console.Write("New Name: ");
                    selectedRoom.Name = Console.ReadLine();

                    Console.Write("New Max Occupancy: ");
                    selectedRoom.MaxOccupancy = int.Parse(Console.ReadLine());

                    roomRepo.Update(selectedRoom);

                    Console.WriteLine($"Room has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a chore"):
                    List <Chore> choreOptions = choreRepo.GetAll();
                    foreach (Chore c in choreOptions)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }

                    Console.Write("Which chore would you like to update? ");
                    int   selectedChoreId = int.Parse(Console.ReadLine());
                    Chore selectedChore   = choreOptions.FirstOrDefault(c => c.Id == selectedChoreId);

                    Console.Write("New Chore: ");
                    selectedChore.Name = Console.ReadLine();

                    choreRepo.Update(selectedChore);

                    Console.WriteLine("Chore has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Delete a room"):
                    List <Room> deleteRoomOptions = roomRepo.GetAll();
                    foreach (Room r in deleteRoomOptions)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }
                    Console.Write("Which room would you like to delete? ");
                    int  selectedRoomToDeleteId = int.Parse(Console.ReadLine());
                    Room selectedRoomToDelete   = deleteRoomOptions.FirstOrDefault(r => r.Id == selectedRoomToDeleteId);

                    roomRepo.Delete(selectedRoomToDeleteId);
                    break;

                case ("Delete a chore"):
                    List <Chore> deleteChoreOptions = choreRepo.GetAll();
                    foreach (Chore c in deleteChoreOptions)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.Write("Which chore would you like to delete? ");
                    int   selectedChoreToDeleteId = int.Parse(Console.ReadLine());
                    Chore selectedChoreToDelete   = deleteChoreOptions.FirstOrDefault(c => c.Id == selectedChoreToDeleteId);

                    choreRepo.Delete(selectedChoreToDeleteId);
                    break;

                case ("Show all chores"):
                    List <Chore> chores = choreRepo.GetAll();
                    foreach (Chore c in chores)
                    {
                        Console.WriteLine($"{c.Name} has an Id of {c.Id}.");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for chore"):
                    Console.Write("Chore Id: ");
                    int choreId = int.Parse(Console.ReadLine());

                    Chore chore = choreRepo.GetById(choreId);

                    Console.WriteLine($"{chore.Id} - {chore.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Exit"):
                    runProgram = false;
                    break;
                }
            }
        }
Example #21
0
        static void Main(string[] args)
        {
            RoomRepository     roomRepo     = new RoomRepository(CONNECTION_STRING);
            ChoreRepository    choreRepo    = new ChoreRepository(CONNECTION_STRING);
            RoommateRepository roommateRepo = new RoommateRepository(CONNECTION_STRING);

            bool runProgram = true;

            while (runProgram)
            {
                string selection = GetMenuSelection();

                switch (selection)
                {
                //room case commands
                case ("Show all rooms"):
                    List <Room> rooms = roomRepo.GetAll();
                    foreach (Room r in rooms)
                    {
                        Console.WriteLine($"{r.Name} has an Id of {r.Id} and a max occupancy of {r.MaxOccupancy}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for room"):
                    Console.Write("Room Id: ");
                    int id = int.Parse(Console.ReadLine());

                    Room room = roomRepo.GetById(id);

                    Console.WriteLine($"{room.Id} - {room.Name} Max Occupancy({room.MaxOccupancy})");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a room"):
                    Console.Write("Room name: ");
                    string name = Console.ReadLine();

                    Console.Write("Max occupancy: ");
                    int max = int.Parse(Console.ReadLine());

                    Room roomToAdd = new Room()
                    {
                        Name         = name,
                        MaxOccupancy = max
                    };

                    roomRepo.Insert(roomToAdd);

                    Console.WriteLine($"{roomToAdd.Name} has been added and assigned an Id of {roomToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a room"):
                    List <Room> roomOptions = roomRepo.GetAll();
                    foreach (Room r in roomOptions)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }

                    Console.Write("Which room would you like to update? ");
                    int  selectedRoomId = int.Parse(Console.ReadLine());
                    Room selectedRoom   = roomOptions.FirstOrDefault(r => r.Id == selectedRoomId);

                    Console.Write("New Name: ");
                    selectedRoom.Name = Console.ReadLine();

                    Console.Write("New Max Occupancy: ");
                    selectedRoom.MaxOccupancy = int.Parse(Console.ReadLine());

                    roomRepo.Update(selectedRoom);

                    Console.WriteLine($"Room has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Delete a room"):
                    List <Room> deleteOptions = roomRepo.GetAll();
                    foreach (Room d in deleteOptions)
                    {
                        Console.WriteLine($"{d.Id} - {d.Name} Max Occupancy({d.MaxOccupancy})");
                    }
                    Console.WriteLine("Please note you may not delete a room if people are living in it");
                    Console.Write("Which empty room would you like to delete?");
                    int  deletedRoomId = int.Parse(Console.ReadLine());
                    Room deletedRoom   = deleteOptions.FirstOrDefault(d => d.Id == deletedRoomId);

                    roomRepo.Delete(deletedRoomId);

                    Console.WriteLine($"Room has been successful deleted");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;


                //chore case commands
                case ("Show all chores"):
                    List <Chore> chores = choreRepo.GetAll();
                    foreach (Chore c in chores)
                    {
                        Console.WriteLine($"{c.Name} has an Id of {c.Id}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for chore"):
                    Console.Write("Chore Id: ");
                    int choreId = int.Parse(Console.ReadLine());

                    Chore chore = choreRepo.GetById(choreId);

                    Console.WriteLine($"{chore.Id} - {chore.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a chore"):
                    Console.Write("Chore name: ");
                    string choreName = Console.ReadLine();

                    Chore choreToAdd = new Chore()
                    {
                        Name = choreName,
                    };

                    choreRepo.Insert(choreToAdd);

                    Console.WriteLine($"{choreToAdd.Name} has been added and assigned an Id of {choreToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a chore"):
                    List <Chore> choreOptions = choreRepo.GetAll();
                    foreach (Chore c in choreOptions)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }

                    Console.Write("Which chore would you like to update? ");
                    int   selectedChoreId = int.Parse(Console.ReadLine());
                    Chore selectedChore   = choreOptions.FirstOrDefault(c => c.Id == selectedChoreId);

                    Console.Write("New Name: ");
                    selectedChore.Name = Console.ReadLine();

                    choreRepo.Update(selectedChore);

                    Console.WriteLine("Chore has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Delete a chore"):
                    List <Chore> deleteChores = choreRepo.GetAll();
                    foreach (Chore d in deleteChores)
                    {
                        Console.WriteLine($"{d.Id} - {d.Name}");
                    }
                    Console.Write("Which chore would you like to delete?");
                    int   deletedChoreId = int.Parse(Console.ReadLine());
                    Chore deletedChore   = deleteChores.FirstOrDefault(d => d.Id == deletedChoreId);

                    choreRepo.Delete(deletedChoreId);

                    Console.WriteLine("Chore has been successful deleted");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                //select a roommate by id

                case ("Search for roommate"):
                    Console.Write("Roommate Id: ");
                    int roommateId = int.Parse(Console.ReadLine());

                    Roommate roommate = roommateRepo.GetById(roommateId);

                    Console.WriteLine($"{roommate.Id} - {roommate.FirstName} {roommate.LastName} pays {roommate.RentPortion}% of the rent. They live in {roommate.Room.Name}.");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;



                case ("Exit"):
                    runProgram = false;
                    break;
                }
            }
        }
Example #22
0
        static void Main(string[] args)
        {
            RoomRepository roomRepo = new RoomRepository(CONNECTION_STRING);

            //Console.WriteLine("Getting All Roommates:");
            //Console.WriteLine();

            //List<Room> allRooms = roomRepo.GetAll();


            //foreach (Room room in allRooms)
            //{
            //    Console.WriteLine($"{room.Id} {room.Name} {room.MaxOccupancy}");
            //}

            RoommateRepository roommateRepo = new RoommateRepository(CONNECTION_STRING);
            ChoreRepository    choreRepo    = new ChoreRepository(CONNECTION_STRING);

            //Console.WriteLine("Getting All Rooms:");
            //Console.WriteLine();

            //List<Roommate> allRoommatesWithRoom = roommateRepo.GetAllWithRoom();



            //            foreach (var roommate in allRoommatesWithRoom)
            //            {
            //                Console.WriteLine(@$"{roommate.Id}
            //{roommate.FirstName} {roommate.LastName}
            //{roommate.RentPortion} {roommate.MoveInDate}
            //{roommate.Room.Name}");
            //            }

            while (true)
            {
                Console.WriteLine();

                int selection = Menu();
                switch (selection)
                {
                case 0:
                    Console.WriteLine("Goodbye");
                    return;

                default:
                    throw new Exception("Something went wrong...invalid selection");

                case 1:
                    List <Room> allRooms = roomRepo.GetAll();
                    foreach (Room room in allRooms)
                    {
                        Console.WriteLine($"{room.Id} {room.Name} {room.MaxOccupancy}");
                    }
                    break;

                case 2:
                    Console.Write($"Enter the name of the new room to add: ");
                    string newName = Console.ReadLine();
                    Console.Write($"Enter {newName}'s Max Occupancy: ");
                    int newMaxOcc = Int32.Parse(Console.ReadLine());


                    Room AddedRoom = new Room
                    {
                        Name         = newName,
                        MaxOccupancy = newMaxOcc
                    };

                    roomRepo.Insert(AddedRoom);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Added the new Room {AddedRoom.Name} with id {AddedRoom.Id}");
                    break;

                case 3:
                    Console.Write($"Enter Id of a room you want to delete: ");
                    int roomId = Int32.Parse(Console.ReadLine());

                    roomRepo.Delete(roomId);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Deleted the room with id {roomId}");
                    break;

                case 4:
                    Console.Write($"Enter the id of the room you'd like to edit: ");
                    int UpdatedRoomId = Int32.Parse(Console.ReadLine());
                    var selectedRoom  = roomRepo.GetById(UpdatedRoomId);

                    Console.Write($"Enter a new name for {selectedRoom.Name} to update database: ");
                    string UpdatedName = Console.ReadLine();

                    Console.Write($"Enter a new Max Occupancy for {selectedRoom.Name} to update database: ");
                    int UpdatedMaxOcc = Int32.Parse(Console.ReadLine());

                    Room UpdatedRoom = new Room
                    {
                        Id           = UpdatedRoomId,
                        Name         = UpdatedName,
                        MaxOccupancy = UpdatedMaxOcc
                    };

                    roomRepo.Update(UpdatedRoom);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Updated the {UpdatedRoom}");
                    break;

                case 5:     //List all roommates
                    List <Roommate> allRoommates = roommateRepo.GetAll();
                    foreach (Roommate roommate in allRoommates)
                    {
                        Console.WriteLine(@$ "
                                Id: {roommate.Id}
                                {roommate.FirstName} {roommate.LastName}
                                Rent Portion: {roommate.RentPortion}
                                Move In Date: {roommate.MoveInDate}
                            ");
                    }
                    break;

                case 6:     //Add a roommate
                    Console.Write($"Enter the name of the new roommate's first name: ");
                    string newFirstName = Console.ReadLine();
                    Console.Write($"Enter the name of the new roommate's last name: ");
                    string newLastName = Console.ReadLine();
                    Console.Write($"Enter {newFirstName}'s Rent share percentage (Enter a number 0-100): ");
                    int         RentPortion   = Int32.Parse(Console.ReadLine());
                    DateTime    MoveInDate    = DateTime.Now;
                    List <Room> allRoomsAgain = roomRepo.GetAll();

                    Console.WriteLine($"Enter {newFirstName}'s room id to rent from the list");
                    foreach (Room room in allRoomsAgain)
                    {
                        Console.WriteLine($"Room Id: {room.Id} Room : {room.Name}:");
                    }
                    Console.Write($"> ");

                    int  NewRoomId          = Int32.Parse(Console.ReadLine());
                    Room newRoomforRoommate = roomRepo.GetById(NewRoomId);


                    Roommate AddedRoommate = new Roommate
                    {
                        FirstName   = newFirstName,
                        LastName    = newLastName,
                        RentPortion = RentPortion,
                        MoveInDate  = MoveInDate,
                        Room        = newRoomforRoommate
                    };

                    roommateRepo.Insert(AddedRoommate);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Added the new Roommate {AddedRoommate.FirstName}{AddedRoommate.LastName}");
                    break;

                case 7:     //Edit a roommate's info

                    List <Roommate> allRoomies = roommateRepo.GetAll();
                    foreach (Roommate roommate in allRoomies)
                    {
                        Console.WriteLine($"Id: {roommate.Id} {roommate.FirstName} {roommate.LastName}");
                    }

                    Console.Write($"Enter the id (listed above) of the roommate you'd like to edit: ");
                    int UpdatedRoommateId = Int32.Parse(Console.ReadLine());
                    var selectedRoommate  = roommateRepo.GetById(UpdatedRoommateId);

                    Console.Write($"Enter a first name for {selectedRoommate.FirstName} to edit the info or type in {selectedRoommate.FirstName} to keep it the same: ");
                    string UpdatedFirstName = Console.ReadLine();

                    Console.Write($"Enter a new last name instead of {selectedRoommate.LastName} or type in {selectedRoommate.LastName} to keep it the same");
                    string UpdatedLastName = Console.ReadLine();

                    Console.Write($"Enter a new rent share percentage (a number 0-100) or type in the current share ({selectedRoommate.RentPortion}) to remain the same: ");
                    int UpdateRentPortion = Int32.Parse(Console.ReadLine());

                    DateTime EditMoveInDate = DateTime.Now;

                    List <Room> allRoomsEncore = roomRepo.GetAll();

                    Console.WriteLine($"Enter a new room id to rent from the list below");
                    foreach (Room room in allRoomsEncore)
                    {
                        Console.WriteLine($"Room Id: {room.Id} Room : {room.Name}:");
                    }
                    Console.Write($"> ");

                    int  EditRoomId             = Int32.Parse(Console.ReadLine());
                    Room updatedRoomforRoommate = roomRepo.GetById(EditRoomId);

                    Roommate UpdatedRoommate = new Roommate
                    {
                        Id          = UpdatedRoommateId,
                        FirstName   = UpdatedFirstName,
                        LastName    = UpdatedLastName,
                        RentPortion = UpdateRentPortion,
                        MoveInDate  = EditMoveInDate,
                        Room        = updatedRoomforRoommate
                    };

                    roommateRepo.Update(UpdatedRoommate);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Updated {UpdatedRoommate.FirstName}{UpdatedRoommate.LastName}'s info");
                    break;

                case 8:     //delete a roommate
                    Console.Write($"Enter Id of a roommate you want to delete: ");
                    int roommateId = Int32.Parse(Console.ReadLine());

                    roomRepo.Delete(roommateId);

                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Deleted the roommate with id {roommateId}");
                    break;

                case 9:    //List all chores
                    List <Chore> allChores = choreRepo.GetAll();
                    foreach (Chore chore in allChores)
                    {
                        Console.WriteLine(@$ "Id: 
{chore.Id}
Name: {chore.Name}");
                    }
                    break;

                case 10:
                    Console.Write($"Enter the name of the new chore to add: ");
                    string newChoreName = Console.ReadLine();

                    Chore AddedChore = new Chore
                    {
                        Name = newChoreName,
                    };
                    choreRepo.Insert(AddedChore);
                    Console.WriteLine("-------------------------------");
                    Console.WriteLine($"Added the new chore '{AddedChore.Name}' with id {AddedChore.Id}");
                    break;
                }
            }
        }
Example #23
0
        static void Main(string[] args)
        {
            RoomRepository     roomRepo     = new RoomRepository(CONNECTION_STRING);
            ChoreRepository    choreRepo    = new ChoreRepository(CONNECTION_STRING);
            RoommateRepository roommateRepo = new RoommateRepository(CONNECTION_STRING);
            bool runProgram = true;

            while (runProgram)
            {
                string selection = GetMenuSelection();

                switch (selection)
                {
                case ("Show all rooms"):
                    List <Room> rooms = roomRepo.GetAll();
                    foreach (Room r in rooms)
                    {
                        Console.WriteLine($"{r.Name} has an Id of {r.Id} and a max occupancy of {r.MaxOccupancy}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for room"):
                    Console.Write("Room Id: ");
                    int id = int.Parse(Console.ReadLine());

                    Room room = roomRepo.GetById(id);

                    Console.WriteLine($"{room.Id} - {room.Name} Max Occupancy({room.MaxOccupancy})");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a room"):
                    Console.Write("Room name: ");
                    string name = Console.ReadLine();

                    Console.Write("Max occupancy: ");
                    int max = int.Parse(Console.ReadLine());

                    Room roomToAdd = new Room()
                    {
                        Name         = name,
                        MaxOccupancy = max
                    };

                    roomRepo.Insert(roomToAdd);

                    Console.WriteLine($"{roomToAdd.Name} has been added and assigned an Id of {roomToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Show all chores"):
                    List <Chore> chores = choreRepo.GetAll();
                    foreach (Chore c in chores)
                    {
                        Console.WriteLine($"{c.Name} has an Id of {c.Id}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a chore"):
                    Console.Write("Chore name: ");
                    string choreName = Console.ReadLine();

                    Chore choreToAdd = new Chore()
                    {
                        Name = choreName
                    };

                    choreRepo.Insert(choreToAdd);
                    break;

                case ("Search for roommate"):
                    Console.Write("Roommate Id: ");
                    int Roommateid = int.Parse(Console.ReadLine());

                    Roommate roommate = roommateRepo.GetById(Roommateid);

                    Console.WriteLine($"Name: {roommate.FirstName}, Rent Portion: {roommate.RentPortion}%, Room: {roommate.RoomName}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Exit"):
                    runProgram = false;
                    break;
                }
            }
        }
Example #24
0
        static void Main(string[] args)
        {
            RoomRepository     roomRepo     = new RoomRepository(CONNECTION_STRING);
            ChoreRepository    choreRepo    = new ChoreRepository(CONNECTION_STRING);
            RoommateRepository roommateRepo = new RoommateRepository(CONNECTION_STRING);
            bool runProgram = true;

            while (runProgram)
            {
                string selection = GetMenuSelection();

                switch (selection)
                {
                case ("Show all rooms"):
                    List <Room> rooms = roomRepo.GetAll();
                    foreach (Room r in rooms)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for room"):
                    Console.Write("Room Id: ");
                    int id = int.Parse(Console.ReadLine());

                    Room room = roomRepo.GetById(id);

                    Console.WriteLine($"{room.Id} - {room.Name} Max Occupancy({room.MaxOccupancy})");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a room"):
                    Console.Write("Room name: ");
                    string name = Console.ReadLine();

                    Console.Write("Max occupancy: ");
                    int max = int.Parse(Console.ReadLine());

                    Room roomToAdd = new Room()
                    {
                        Name         = name,
                        MaxOccupancy = max
                    };

                    roomRepo.Insert(roomToAdd);
                    Console.WriteLine($"{roomToAdd.Name} has been added and assigned an Id of {roomToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Show all chores"):
                    List <Chore> chores = choreRepo.GetAll();
                    foreach (Chore c in chores)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for chore"):
                    Console.WriteLine("Chore Id: ");
                    int   choreId = int.Parse(Console.ReadLine());
                    Chore chore   = choreRepo.GetById(choreId);
                    Console.WriteLine($"{chore.Id} - {chore.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Add a chore"):
                    Console.WriteLine("Chore name: ");
                    string choreName  = Console.ReadLine();
                    Chore  choreToAdd = new Chore()
                    {
                        Name = choreName
                    };
                    choreRepo.Insert(choreToAdd);
                    Console.WriteLine($"{choreToAdd.Name} has been added and assigned an Id of {choreToAdd.Id}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Search for roommate"):
                    Console.WriteLine("Roommate Id: ");
                    int      roommateId = int.Parse(Console.ReadLine());
                    Roommate roommate   = roommateRepo.GetById(roommateId);
                    Console.WriteLine($"{roommate.Firstname}:");
                    Console.WriteLine($"    Rent Portion:{roommate.RentPortion}");
                    Console.WriteLine($"    Room: {roommate.Room.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Unassigned chores"):
                    List <Chore> unassignedchores = choreRepo.UnassignedChores();
                    foreach (Chore c in unassignedchores)
                    {
                        Console.WriteLine(c.Name);
                    }
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Assign chore to roommate"):
                    List <Chore>    choreList    = choreRepo.GetAll();
                    List <Roommate> roommateList = roommateRepo.GetAll();
                    foreach (Chore c in choreList)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.WriteLine("Please enter the id of the chore.");
                    int   choreIdToAdd = int.Parse(Console.ReadLine());
                    Chore chore1       = choreRepo.GetById(choreIdToAdd);
                    foreach (Roommate r in roommateList)
                    {
                        Console.WriteLine($"{r.Id} - {r.Firstname} {r.Lastname}");
                    }
                    Console.WriteLine("Please enter the id of the roommate.");
                    int      roommateIdToAdd = int.Parse(Console.ReadLine());
                    Roommate roommate1       = roommateRepo.GetById(roommateIdToAdd);
                    choreRepo.assignChore(roommateIdToAdd, choreIdToAdd);
                    Console.WriteLine($"{roommate1.Firstname} {roommate1.Lastname} has been assigned to {chore1.Name}");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Update a room"):
                    List <Room> roomOptions = roomRepo.GetAll();
                    foreach (Room r in roomOptions)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name} Max Occupancy({r.MaxOccupancy})");
                    }

                    Console.Write("Which room would you like to update? ");
                    int  selectedRoomId = int.Parse(Console.ReadLine());
                    Room selectedRoom   = roomOptions.FirstOrDefault(r => r.Id == selectedRoomId);

                    Console.Write("New Name: ");
                    selectedRoom.Name = Console.ReadLine();

                    Console.Write("New Max Occupancy: ");
                    selectedRoom.MaxOccupancy = int.Parse(Console.ReadLine());

                    roomRepo.Update(selectedRoom);

                    Console.WriteLine($"Room has been successfully updated");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Delete room"):
                    List <Room> allRooms = roomRepo.GetAll();
                    foreach (Room r in allRooms)
                    {
                        Console.WriteLine($"{r.Id} - {r.Name}");
                    }
                    Console.WriteLine("Selecet the Id of the room to delete.");
                    int roomToDelete = int.Parse(Console.ReadLine());
                    roomRepo.Delete(roomToDelete);
                    break;

                case ("Update a chore"):
                    List <Chore> choreOptions = choreRepo.GetAll();
                    foreach (Chore c in choreOptions)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.WriteLine("Which chore would you like to update?");
                    int   selectedChoreId = int.Parse(Console.ReadLine());
                    Chore selectedChore   = choreOptions.FirstOrDefault(c => c.Id == selectedChoreId);
                    Console.WriteLine("New Name: ");
                    selectedChore.Name = Console.ReadLine();
                    choreRepo.Update(selectedChore);
                    Console.WriteLine("Chore has been successfully updates.");
                    Console.Write("Press any key to continue");
                    Console.ReadKey();
                    break;

                case ("Delete chore"):
                    List <Chore> allChore = choreRepo.GetAll();
                    foreach (Chore c in allChore)
                    {
                        Console.WriteLine($"{c.Id} - {c.Name}");
                    }
                    Console.WriteLine("Selecet the Id of the chore to delete.");
                    int choreToDelete = int.Parse(Console.ReadLine());
                    choreRepo.Delete(choreToDelete);
                    break;

                case ("Exit"):
                    runProgram = false;
                    break;
                }
            }
        }