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 }); }
//Get All Customer public IEnumerable <Customer> GetAllCustomer() { return(customerDb.GetAllCustomers()); }
// GET: Customer public ActionResult Index() { var customers = CustomerDb.GetAllCustomers(); return(Json(customers)); }