日期:2014-05-20 浏览次数:21039 次
private EFEntities db = new EFEntities(); /// <summary> /// 获取模块列表 /// </summary> /// <param name="uid"></param> /// <returns></returns> public List<models> FindModels(int uid, int modelId) { var model_list = from p in db.model_in_role join r in db.teacher_in_role on p.RoleId equals r.RoleId where r.Uid == uid select p.ModelIdList; List<models> models = new List<models>(); if (model_list.Count() > 0) { //显示数据 string[] mms = model_list.First().Split(','); List<int> alModelId = new List<int>(); foreach (var mm in mms) { //StringHelper.StringToInt 是把string 转成 int int mId = StringHelper.StringToInt(mm); if (mId > 0) { alModelId.Add(mId); } } var ms = from p in db.models where alModelId.Contains(p.ModelId) && p.Pid == modelId select p; models = ms.ToList(); } return models; }
var ms = from p in db.models where alModelId.Contains(p.ModelId) && p.Pid == modelId select p; models = ms.ToList();