コード例 #1
0
        public int DeleteUserPick()
        {
            Console.Clear();
            Various.Header($"{UserRepository.currentUser.Username} : Delete User");

            ViewUsersExtended();
            Console.WriteLine();

            int userId = PickUser();

            if (userId == -1)
            {
                return(-1);
            }

            Console.Write("Are you sure? (Y/N): ");
            string yesOrNo = Various.TypeLetterByLetterWithoutMaskingYesOrNoSTR();

            if (yesOrNo == "Y" || yesOrNo == "y")
            {
                return(userId);
            }
            else
            {
                return(-1);
            }
        }
コード例 #2
0
        public void DeleteAMessageBetweenTwoUsers(List <Message> messages)
        {
            if (messages.Count == 0)
            {
                Console.WriteLine();
                Various.SystemMessage("There are no messages");
                System.Threading.Thread.Sleep(2000);
                return;
            }
            Console.Clear();
            MenuDesigner MessageMenu       = new MenuDesigner(messages, $"{UserRepository.currentUser.Username} : Delete Message");
            int          messageViewChoice = MessageMenu.MenuDesignMessage(out int correctMessageId);

            if (correctMessageId < 0)
            {
                Various.SystemMessage("Delete Message Failed");
                System.Threading.Thread.Sleep(2000);
                return;
            }
            Console.Clear();
            Various.Header($"{UserRepository.currentUser.Username} : Delete Message");
            Console.WriteLine(MessageRepository.ViewMessageWithoutChangingRead(correctMessageId));
            Console.WriteLine();
            Console.Write("Are you sure? (Y / N): ");
            string yesOrno = Various.TypeLetterByLetterWithoutMaskingYesOrNoSTR();

            if (yesOrno == "y" || yesOrno == "Y")
            {
                MessageRepository.DeleteMessage(correctMessageId);
                Console.WriteLine();
                Various.SystemMessageSuccess("Message Deleted");
                System.Threading.Thread.Sleep(1500);
            }
            else
            {
                Console.WriteLine();
                Various.SystemMessage("Delete Message failed");
                System.Threading.Thread.Sleep(1500);
            }
        }