public bool UpdateLevelDetailsList(List<LevelDetailsDALDTO> LevelDetailsObjToUpdate)
{
bool result = false;
//List<LevelDetail> editLevelDetails = DBContext.LevelDetails.Where(g => g.LevelID == a.LevelID).ToList();
List<LevelDetail> levelDetails = DBContext.LevelDetails.ToList();
List<VisioShapeData> VisioData = DBContext.VisioShapeDatas.ToList();
foreach (LevelDetailsDALDTO a in LevelDetailsObjToUpdate)
{
//List<LevelDetail> editLevelDetails = DBContext.LevelDetails.Where(g => g.LevelID == a.LevelID).ToList();
List<LevelDetail> editLevelDetails = levelDetails.Where(x => x.LevelID == a.LevelID).ToList();
List<VisioShapeData> updatevisiodata = VisioData.Where(x => x.ID == a.ID).ToList();
if (a.CreatedDate == DateTime.MinValue)
a.CreatedDate = DateTime.Now;
if (a.ModifiedDate == DateTime.MinValue)
a.ModifiedDate = DateTime.Now;
if (editLevelDetails != null)
{
foreach (LevelDetail b in editLevelDetails)
{
b.Cost += a.Cost;
b.Time += a.Time;
b.Responsible = b.Responsible + "," + a.Responsible;
b.ModifiedBy = a.ModifiedBy;
b.ModifiedDate = a.ModifiedDate;
}
if (updatevisiodata != null)
{
foreach (VisioShapeData c in updatevisiodata)
{
c.Level4Id = a.LevelID;
}
}
if (DBContext.SaveChanges() > 0)
result = true;
}
}
return result;
}
希望在
中结合这两个陈述List<LevelDetail> editLevelDetails = levelDetails.Where(x => x.LevelID == a.LevelID).ToList();
List<VisioShapeData> updatevisiodata = VisioData.Where(x => x.ID == a.ID).ToList();
和