コード例 #1
0
 static void HandleUpdateOperation()
 {
     Console.Write("Enter Job Id to Update: ");
     if (int.TryParse(Console.ReadLine(), out var temp))
     {
         JobModel.JobId = temp;
     }
     else
     {
         JobModel.JobId = 0;
         Console.WriteLine("Input is not in numbers..INVALID");
     }
     if (SqlServer.CheckJobExists())
     {
         UserInteraction.GetJobDetails();
         SqlServer.UpdateJob();
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            while (true)
            {
                switch (UserInteraction.GetCRUDOperation())
                {
                case 1:
                    UserInteraction.GetJobDetails();
                    SqlServer.InsertJob();
                    break;

                case 2:
                    HandleRetrieveOperation();
                    break;

                case 3:
                    HandleUpdateOperation();
                    break;

                case 4:
                    HandleDeleteOperation();
                    break;

                default:
                    Console.WriteLine("Choise is Not awailable..exiting..!");
                    break;
                }

                Console.Write("\nWant to do another operation ? Y/N  :   ");
                var userInput = Console.ReadLine();
                if (!(userInput == "Y" || userInput == "y"))
                {
                    break;
                }
            }
            Console.WriteLine("\nProgram is Terminating...!");
            Thread.Sleep(500);
        }