public List <BlackListDetail> GetBlackList(Guid userId) { var q = _context.BlackLists.Where(x => x.CreateUserId == userId).ToList(); var list = new List <BlackListDetail>(); foreach (var item in q) { var model = new BlackListDetail(); model.Info = item; model.Areas = _context.ManToAreas.Where(x => x.ActiveId == item.Id).ToList(); model.goodInfo = _context.GoodInfoes.FirstOrDefault(x => x.Id == item.GoodsId); list.Add(model); } return(list); }
public BlackListDetail GetBlackListDetail(Guid Id) { var q = _context.BlackLists.FirstOrDefault(x => x.Id == Id); if (q == null) { return(null); } var model = new BlackListDetail(); model.Info = q; model.Areas = _context.ManToAreas.Where(x => x.ActiveId == q.Id).ToList(); model.goodInfo = _context.GoodInfoes.FirstOrDefault(x => x.Id == q.GoodsId); return(model); }