0
我有一個操作接受多個要過濾的值。這些值是可選的。我設置了默認值。默認值覆蓋我通過的值。默認值爲重寫值
如果我通過: minAge:40,maxAge:40。這兩個值都設置爲0。
這是我的控制器上的操作:
[HttpGet]
public ActionResult DataTableUpdate(string firstName = "", string lastName = "", int minAge = 0, int maxAge = 0, string currentState = "")
{
List<DataMember> data = DataMemberCache.GetMembers().FindAll(d => (d.FirstName.Contains(firstName)) && (d.LastName.Contains(lastName)) && (d.Age < minAge) && (d.Age > maxAge) && (d.CurrentState.Contains(currentState)));
return PartialView("_DataTable", data);
}