Exemplo n.º 1
0
        static void Main(string[] args)
        {
            CustomerManager customerManager = new CustomerManager();

            Console.WriteLine("1. Yeni Müşteri");
            Console.WriteLine("2. Müşteri Güncelle");
            Console.WriteLine("3. Müşteri Sil");
            Console.WriteLine("4. Müşterileri listele");
            Console.WriteLine("***************************************************");

            var answer = Console.ReadLine();

            if (answer == "1")
            {
                Customer customer = new Customer();
                Console.Write("Id Giriniz: ");
                customer.Id = Convert.ToInt32(Console.ReadLine());
                Console.Write("Ad Giriniz: ");
                customer.FirstName = Console.ReadLine();
                Console.Write("Soyad Giriniz: ");
                customer.LastName = Console.ReadLine();

                customerManager.Add(customer);
                var listOfCustomer = customerManager.GetAll();
            }
            else if (answer == "2")
            {
                customerManager.GetAll();
                Customer customer = new Customer();

                Console.Write("Güncellemek istediğiniz müşteriye ait Id Giriniz: ");
                customer.Id = Convert.ToInt32(Console.ReadLine());
                Console.Write("Ad Giriniz: ");
                customer.FirstName = Console.ReadLine();
                Console.Write("Soyad Giriniz: ");
                customer.LastName = Console.ReadLine();

                customerManager.Update(customer);

                var listOfCustomer = customerManager.GetAll();
            }
            else if (answer == "3")
            {
                var      listOfCustomer = customerManager.GetAll();
                Customer customer       = new Customer();

                Console.Write("Silmek istediğiniz müşteriye ait Id Giriniz: ");
                customer.Id = Convert.ToInt32(Console.ReadLine());
                customerManager.Delete(customer);

                listOfCustomer = customerManager.GetAll();
            }
            else
            {
                var listOfCustomer = customerManager.GetAll();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var customer        = new Customer();
            var customerManager = new CustomerManager();

            var customers       = new List <Customer>();
            var defaultCustomer = new Customer
            {
                Name      = "İsmail",
                Surname   = "Gümüş",
                Age       = 37,
                City      = "Ankara",
                IsDeleted = false,
                Id        = 1
            };

            customers.Add(defaultCustomer);

            Console.WriteLine("1. Müşteri Ekle");
            Console.WriteLine("2. Müşteri Sil");
            Console.WriteLine("3. Müşteri Güncelle");
            Console.WriteLine("Yapmak istediğiniz işlemi seçiniz:");
            var operation = Convert.ToInt32(Console.ReadLine());

            switch (operation)
            {
            case 1:
                Console.WriteLine("Müşteri Adı:");
                customer.Name = Console.ReadLine();
                Console.WriteLine("Müşteri Soyadı:");
                customer.Surname = Console.ReadLine();
                Console.WriteLine("Müşteri Şehri:");
                customer.City = Console.ReadLine();
                Console.WriteLine("Müşteri Yaşı:");
                customer.Age = Convert.ToInt32(Console.ReadLine());
                customerManager.Add(customer);
                break;

            case 2:
                customerManager.ListAll(customers);
                Console.WriteLine("Silmek istediğiniz müşteriyi id'sini seçiniz:");
                var selectedCustomer = Convert.ToInt32(Console.ReadLine());
                customer = customers.FirstOrDefault(x => x.Id == selectedCustomer);
                customerManager.Delete(customer);
                break;

            case 3:
                customerManager.ListAll(customers);
                Console.WriteLine("Güncellemek istediğiniz müşteriyi id'sini seçiniz:");
                selectedCustomer = Convert.ToInt32(Console.ReadLine());
                customer         = customers.FirstOrDefault(x => x.Id == selectedCustomer);
                customerManager.Update(customer);
                break;
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer();

            customer1.Id       = 1;
            customer1.Name     = "Ayşe";
            customer1.LastName = "İlkay";
            customer1.Address  = "İzmir";

            CustomerManager customerManager = new CustomerManager(new SampleCustomerDal());

            customerManager.Add(customer1);
            customerManager.Update(customer1);
            customerManager.Delete(customer1);
            customerManager.GetAll();
            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer();

            customer1.Id      = 001;
            customer1.Name    = "Doğukan";
            customer1.SurName = "Doğu";

            Customer customer2 = new Customer();

            customer2.Id      = 002;
            customer2.Name    = "Ali İhsan";
            customer2.SurName = "Çalıkuşu";

            Customer customer3 = new Customer();

            customer3.Id      = 003;
            customer3.Name    = "Burkay";
            customer3.SurName = "Ağgül";

            Customer customer4 = new Customer();

            customer4.Id      = 004;
            customer4.Name    = "Fikri";
            customer4.SurName = "Tabar";

            Customer[] customers = new Customer[] { customer1, customer2, customer3, customer4 };

            CustomerManager customerManager = new CustomerManager();

            Console.WriteLine("//Listed Method");
            customerManager.List(customers);

            Console.WriteLine("--------------");
            Console.WriteLine("//Added Method");
            customerManager.Add(customer1);
            Console.WriteLine("----------------------------");
            Console.WriteLine("//Updated Method");
            customerManager.Update(customer2);
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("//Deleted Method");
            customerManager.Delete(customer3);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer();

            customer1.Id        = 12;
            customer1.Name      = "Engin";
            customer1.Surname   = "Demir";
            customer1.IsRetired = false;

            Customer customer2 = new Customer();

            customer2.Id        = 21;
            customer2.Name      = "Berkay";
            customer2.Surname   = "Bilgin";
            customer2.IsRetired = false;

            CustomerManager customerManager = new CustomerManager();

            customerManager.Add(customer1);
            customerManager.Add(customer2);
            customer1.Surname = "Demiroğ";
            customerManager.Update(customer1);
            customerManager.Delete(customer2);
        }
Exemplo n.º 6
0
            static void UpdateCustomer(CustomerManager customerManager, Customer customer)
            {
                var customerInfo = customerManager.Update(customer);

                Console.WriteLine(customerInfo);
            }