Example #1
0
        public static void GetCustomersInCategory(string name)
        {
            IEnumerable <Customer> customers  = CustomerDb.GetAllCustomers();
            IEnumerable <Category> categories = CategoryDb.GetAllCategories();


            IEnumerable <CustomersGoods> customerGoodsDbs = CustomerGoodsDb.GetCustomerGoods();
            var listOfCategories = categories.Where(p => p.Name == name);

            var needProducts = listOfCategories.Join(customerGoodsDbs,
                                                     c => c.Product.IdGoods, cg => cg.Product.IdGoods, (c, cg) => new { Id = cg.Customer.IdCustomer });

            var result = needProducts.Join(customers, arg => arg.Id, c => c.IdCustomer,
                                           (arg, c) => new { Name = c.Name });
        }
Example #2
0
 //Get All Customer
 public IEnumerable <Customer> GetAllCustomer()
 {
     return(customerDb.GetAllCustomers());
 }
Example #3
0
        // GET: Customer
        public ActionResult Index()
        {
            var customers = CustomerDb.GetAllCustomers();

            return(Json(customers));
        }