Example #1
0
        static void Main(string[] args)
        {
            //Dependency Injection
            //Accounting_DBEntities db = new Accounting_DBEntities();
            //ICustomerRepository customer = new CustomerRepository(db);
            //----------------------------------------------------------
            //var list = customer.GetAllCustomers();
            //Console.WriteLine("لطفا کد شخص را وارد کنید");
            //int id = int.Parse(Console.ReadLine());
            //customer.DeleteCustomer(id);
            //customer.Save();
            //Customers list = customer.GetCustomerById(id);
            //Customers AddCustomer = new Customers()
            //{
            //    FullName = "Pedram",
            //    EmailAddress="*****@*****.**",
            //    CustomerImage="NO",
            //    Mobile="09358566006"
            //};
            //customer.InsertCustomer(AddCustomer);
            //customer.Save();
            //foreach (var item in list)
            //{
            //    Console.WriteLine($"Name: {item.FullName} , Mobile: {item.Mobile} , Email: {item.EmailAddress}");
            //}
            //UnitOfWork

            Accounting_DBEntities         db = new Accounting_DBEntities();
            GenericRepository <Customers> customerRepository = new GenericRepository <Customers>(db);
            var list = customerRepository.GetById(2);

            db.Dispose();
            Console.ReadKey();
        }
 public void Dispose()
 {
     db.Dispose();
 }