日期:2014-05-20 浏览次数:21050 次
var q = from c in db.NewsType
where c.NewsType_Id == id
select c;
var w = from c in db.News
where c.News_TypeId == id
select c;
if (q.Count() > 0)
{
for (int e = 0; e < w.Count(); e++)
{
db.News.DeleteOnSubmit(w.First());
db.SubmitChanges();
}
db.NewsType.DeleteOnSubmit(q.First());
db.SubmitChanges();
return true;
}
else
{
return false;
}