private void LoadOrClear() { if (size != null && !(Commentaries.Any() && Materials.Any() && Pribors.Any())) { using (var db = new SmetaApplication.DbContexts.SmetaDbAppContext()) { Materials.Clear(); db.MaterialGroups.Where(x => x.WorkId == Id).ToList().ForEach(x => { Materials.Add(new MaterialGroupDemView(x, diff + 1)); }); Pribors.Clear(); db.PriborGroups.Where(x => x.WorkId == Id).ToList().ForEach(x => { Pribors.Add(new PriborGroupView(x)); }); Commentaries.Clear(); db.Commentaries.Where(x => x.WorkSectionId == WorkSectionId).ToList().ForEach(x => { Commentaries.Add(new CommentaryView(x)); }); } } else { Commentaries.Clear(); Materials.Clear(); Pribors.Clear(); } }
public void AddCommentary(Commentary commentary) { Commentaries.Add(commentary); }
public void IncomingCommentary(Message message) { Commentaries.Add(message); }