Ejemplo n.º 1
0
        public static void DestroyUser()
        {
            Console.WriteLine("Input user ID that you would like to remove");
            string UserID = Console.ReadLine();

            DbConnector.Execute($"DELETE FROM Users WHERE id = {UserID}");
        }
Ejemplo n.º 2
0
        public static void Delete()
        {
            System.Console.WriteLine("Which user would you like to delete?");
            Read();
            System.Console.WriteLine("Please select the user's ID:");
            string UserID = Console.ReadLine();

            DbConnector.Execute($"DELETE FROM User WHERE idUser = {UserID};");
            Read();
        }
Ejemplo n.º 3
0
        public static void CreateUser()
        {
            Console.WriteLine("Input your First name");
            string FirstName = Console.ReadLine();

            Console.WriteLine("Input your Last name");
            string LastName = Console.ReadLine();

            Console.WriteLine("Input your Favorite number");
            string FavoriteNumber = Console.ReadLine();

            DbConnector.Execute($"INSERT INTO Users (FirstName, LastName, FavoriteNumber) VALUES ('{FirstName}', '{LastName}', {FavoriteNumber})");
        }
Ejemplo n.º 4
0
        public static void Add()
        {
            System.Console.WriteLine("Adding new user...");
            System.Console.WriteLine("First Name:");
            string FirstName = Console.ReadLine();

            System.Console.WriteLine("Last Name:");
            string LastName = Console.ReadLine();

            System.Console.WriteLine("Favorite Number:");
            string FavoriteNumber = Console.ReadLine();

            DbConnector.Execute($"INSERT INTO User (FirstName, LastName, FavoriteNumber) VALUES ('{FirstName}', '{LastName}', '{FavoriteNumber}')");
            Read();
        }
Ejemplo n.º 5
0
        public static void UpdateUser()
        {
            Console.WriteLine("Input user ID that you would like to update");
            string UserID = Console.ReadLine();

            Console.WriteLine("Input your First name");
            string FirstName = Console.ReadLine();

            Console.WriteLine("Input your Last name");
            string LastName = Console.ReadLine();

            Console.WriteLine("Input your Favorite number");
            string FavoriteNumber = Console.ReadLine();

            DbConnector.Execute($"UPDATE Users SET FirstName = '{FirstName}' WHERE id = {UserID}");
        }
Ejemplo n.º 6
0
        public static void Update()
        {
            Read();
            System.Console.WriteLine("Please select the user's ID number to update the information contained");
            string ID = Console.ReadLine();

            Console.WriteLine("Please enter First Name:");
            string FirstName = Console.ReadLine();

            Console.WriteLine("Please enter Last Name:");
            string LastName = Console.ReadLine();

            Console.WriteLine("Please enter Favorite Number:");
            string FavoriteNumber = Console.ReadLine();

            DbConnector.Execute($"UPDATE User SET FirstName='{FirstName}', LastName='{LastName}', FavoriteNumber='{FavoriteNumber}' WHERE idUser={ID}");
            Read();
        }
Ejemplo n.º 7
0
 public static void deleteUser(int userId)
 {
     DbConnector.Execute($"delete from Users where id={userId}");
 }
Ejemplo n.º 8
0
 public static void updateUser(string firstName, int userId)
 {
     DbConnector.Execute($"update Users set FirstName='{firstName}' where id={userId}");
 }
Ejemplo n.º 9
0
 public static void addUser(string firstName, string lastName, int favoriteNumber)
 {
     DbConnector.Execute($"insert into Users(FirstName, LastName, FavoriteNumber) values('{firstName}', '{lastName}', '{favoriteNumber}')");
     Console.WriteLine($"Successfully added {firstName} {lastName} to the database");
 }