0
Public JsonResult GetDetails()
{
List<Cust> Customers = new List<Cust>();
Customers = GetCustomerDetails();
var name = Customers.Select(e => new{e.custname}).Distinct().ToList();
var dept = Customers.Select(e => new{e.deptname}).Distinct().ToList();
var response = new{CustomerNames = name, CustomerDepartments = dept};
return Json(response, JsonRequestBehaviour.AllowGet();
}
我有这样的上述方法返回JSON对象,现在该方法具有以返回与一个其返回沿该响应的子集,是有可能做的滤波器在部门类型上并从相同方法返回两个jon对象。在控制器的方法,返回两个JSON对象
非常感谢您的回复......是否可以选择部门名称为IT,名称以'N'开头的所有客户,我们可以合并两个结果。 – Agasthya
是的。你可以使用[StartsWith](http://stackoverflow.com/questions/34777044/linq-query-using-contains-is-not-working/34777091#34777091)扩展方法 – Shyju
,但我怎样才能合并名称和部门和将其存储在上述响应对象的属性中。 – Agasthya