public bool CreateMessage()
        {
            User Receiver = MainActions.SelectUser();

            Console.WriteLine("Add a title:");
            string title = Console.ReadLine();

            Console.WriteLine("Send the message");
            string text = Console.ReadLine();

            PersonalMessage NewPersonalMessage = new PersonalMessage()
            {
                SenderID            = ActiveUser.UserID,
                ReceiverID          = Receiver.UserID,
                TitleText           = title,
                PersonalMessageText = text
            };

            return(DataHandler.CreatePersonalMessageData(NewPersonalMessage));
        }
Beispiel #2
0
        public bool UpdateUserAccess()
        {
            string UpdateSelection = SelectMenu.Horizontal(new List <string>
            {
                UPGRADE,
                DOWNGRADE,
                BACK
            }).NameOfChoice;

            switch (UpdateSelection)
            {
            case UPGRADE:

                User SelectedUser = MainActions.SelectUser();
                switch (SelectedUser.TypeOfUser)
                {
                case UserType.Guest:
                    Console.WriteLine("Upgrade to User or Admin;");
                    string AdminChoice = SelectMenu.Horizontal(new List <string> {
                        USER, ADMIN
                    }).NameOfChoice;

                    switch (AdminChoice)
                    {
                    case USER:
                    default:
                        SelectedUser.TypeOfUser = UserType.User;
                        break;

                    case ADMIN:
                        SelectedUser.TypeOfUser = UserType.Administrator;
                        break;
                    }
                    break;

                case UserType.User:
                    SelectedUser.TypeOfUser = UserType.Administrator;
                    break;

                case UserType.Administrator:
                default:
                    break;
                }
                DataProvider.UpdateUserAccess(SelectedUser);
                break;

            case DOWNGRADE:
                Console.WriteLine("Choose the user you want to Downgrade:");
                User UserSelection = MainActions.SelectUser();
                switch (UserSelection.TypeOfUser)
                {
                case UserType.Administrator:
                    Console.WriteLine("Downgrade to User or Guest;");
                    string AdminChoice = SelectMenu.Horizontal(new List <string> {
                        USER, GUEST
                    }).NameOfChoice;
                    switch (AdminChoice)
                    {
                    case USER:
                    default:
                        UserSelection.TypeOfUser = UserType.User;
                        break;

                    case GUEST:
                        UserSelection.TypeOfUser = UserType.Guest;
                        break;
                    }
                    break;

                case UserType.User:
                    UserSelection.TypeOfUser = UserType.Guest;
                    break;

                case UserType.Guest:
                default:
                    break;
                }
                DataProvider.UpdateUserAccess(UserSelection);
                break;

            case BACK:
                return(false);
            }
            return(true);
        }