Ejemplo n.º 1
0
        // Updating user
        public static void UpdateUser()
        {
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("Updating of User\n");
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("Enter new FirstName:");
            string firstName = Console.ReadLine();

            Console.WriteLine("Enter new LastName:");
            string lastName = Console.ReadLine();

            Console.WriteLine("Enter new Username:"******"Enter new Password:");
            string password = Console.ReadLine();

            UserModel user = new UserModel
            {
                FirstName = firstName,
                LastName  = lastName,
                Username  = username,
                Password  = password,
            };

            try
            {
                var response = UserRequests.UpdateUser(Token, user);
                Console.WriteLine(response);
            }
            catch (AppException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.Message);
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Ejemplo n.º 2
0
        // Registration of user
        public static void Register()
        {
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("Regstration of User\n");
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;

            UserModel user = GetRegUserData();

            try
            {
                var response = UserRequests.Register(user);
                Console.WriteLine($"Ok\nID = {response}");
            }
            catch (AppException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.Message);
                Console.ForegroundColor = ConsoleColor.White;
            }
        }