Exemple #1
0
        /// <summary>
        /// Method to take input to update the record inside the address book with help of name passed
        /// </summary>
        public static void UpdateCall()
        {
            Console.WriteLine("Enter the name of the record to edit.");
            string recordName = Console.ReadLine();

            /// Getting the data which you want to update
            Console.WriteLine("Enter the choice you want to update ===>");
            Console.WriteLine("1.Contact Type.");
            Console.WriteLine("2.Address Book Name.");
            int  choice = Convert.ToInt32(Console.ReadLine());
            bool result = false;

            switch (choice)
            {
            case 1:
                Console.WriteLine("Enter the new contact type (Friends,Family and Profession) -");
                string type = Console.ReadLine();
                /// Getting the return for the result of the update query
                result = repository.EditContactUsingName(recordName, type, choice);
                break;

            case 2:
                Console.WriteLine("Enter the address book name -");
                string addressBookName = Console.ReadLine();
                /// Getting the return for the result of the update query
                result = repository.EditContactUsingName(recordName, addressBookName, choice);
                break;

            default:
                Console.WriteLine("Entered choice is wrong.....");
                break;
            }
            /// Testing for the success of the update to the table
            Console.WriteLine((result)? "Updated Successfully": "Update failed");
        }