Using Contains filter can do the same items!

If you want to filter for similar items between an array, the Contains can do.

 As described in this case, it is selected, do not contain itemList value in the list.

  public List<int> FilterTemp_InfoBooth_R(int tempID)
  {
    return base.LoadRepository.GetEntities<Info_BoothTemp_Info_R>().Where(i => i.BoothTempID == tempID).Select(i => i.BoothInfoID).ToList<int>();
  }
public ActionResult AddExitsInfo_InTo_BoothTemp(int? page)
{
    int tempID;
    int.TryParse(Request.QueryString["tempid"], out tempID);
    ViewBag.tempID = tempID;

    List<int> itemList = info_BoothManager.FilterTemp_InfoBooth_R(tempID);
    PredicateList<Info_BoothInfo> predict = new PredicateList<Info_BoothInfo>();
    predict.Add(i => !itemList.Contains(i.BoothInfoID));

    PagingParam pp = new PagingParam(page ?? 1, 15);
    var listModel = info_BoothManager.GetModel_BoothInfo(predict, pp);

    return View(listModel);
}

 

 

Reproduced in: https: //www.cnblogs.com/Kummy/archive/2013/05/14/3077131.html

Guess you like

Origin blog.csdn.net/weixin_33766168/article/details/93428300