Exemple #1
0
        public void menu_newsuser()
        {
            int input;

            Controllers.News_User_Controller panggil = new Controllers.News_User_Controller();
            BaseContext _context = new BaseContext();
            Program     call     = new Program();

            Console.Clear();
            Console.WriteLine("======================================================");
            Console.WriteLine("|                 News User Page                     |");
            Console.WriteLine("======================================================");
            Console.WriteLine("| 1. View All                                        |");
            Console.WriteLine("| 2. Get By Id                                       |");
            Console.WriteLine("| 3. Insert                                          |");
            Console.WriteLine("| 4. Update                                          |");
            Console.WriteLine("| 5. Delete                                          |");
            Console.WriteLine("======================================================");
            Console.WriteLine("\n");
            Console.Write("Silahkan Pilih : "); int pil = Convert.ToInt32(Console.ReadLine());


            switch (pil)
            {
            case 1:
                panggil.ViewAll();
                break;

            case 2:
                Console.Write("Masukkan Id yang dicari : "); input = Convert.ToInt32(Console.ReadLine());
                panggil.GetById(input);
                break;

            case 3:
                panggil.insert();
                break;

            case 4:
                Console.Write("Masukkan Id yang akan di Update : "); input = Convert.ToInt32(Console.ReadLine());
                panggil.update(input);
                break;

            case 5:
                break;

            default:
                break;
            }
        }
Exemple #2
0
        public void menu_newsuser()
        {
            Controllers.News_User_Controller panggil = new Controllers.News_User_Controller();
            BaseContext _context = new BaseContext();
            Program     call     = new Program();

            Console.Clear();
            Console.WriteLine("======================================================");
            Console.WriteLine("|                 News User Page                     |");
            Console.WriteLine("======================================================");
            Console.WriteLine("| 1. View All                                        |");
            Console.WriteLine("| 2. Insert                                          |");
            Console.WriteLine("| 3. Update                                          |");
            Console.WriteLine("| 4. Delete                                          |");
            Console.WriteLine("======================================================");
            Console.WriteLine("\n");
            Console.Write("Silahkan Pilih : "); int pil = Convert.ToInt32(Console.ReadLine());

            /*
             * Kondisi apabila pilihan 1 maka akan memanggil function viewAll() dan seterunya
             */

            switch (pil)
            {
            case 1:
                panggil.ViewAll();
                break;

            case 2:
                panggil.insert();
                break;

            case 3:
                Console.Write("Masukkan Id yang akan di Update : "); input = Convert.ToInt32(Console.ReadLine());
                panggil.update(input);
                break;

            case 4:
                Console.Write("Masukkan Id yang akan di Hapus : "); input = Convert.ToInt32(Console.ReadLine());
                Delete(input);
                break;

            default:
                break;
            }
        }