public void UpdateEvaluationC(ICollection <EvaluationCritereaDTO> evc) { foreach (var item in EvaluationCritereas.ToList()) { var ecMatch = evc.FirstOrDefault(e => e.EvaluationCritereaId == item.EvaluationCritereaId); if (ecMatch == null) { EvaluationCritereas.Remove(item); } else { item.Title = ecMatch.Title; } } foreach (var item in evc) // adds products that have not been assigned an ID yet (long is default 0) { if (item.EvaluationCritereaId == 0) { var ev = new EvaluationCriterea(); ev.Title = item.Title; EvaluationCritereas.Add(ev); } } }
public Project(ProjectDTO dto, long schoolId) { ProjectName = dto.ProjectName; ProjectDescr = dto.ProjectDescr; ProjectImage = dto.ProjectImage; ProjectBudget = dto.ProjectBudget; ESchoolGrade = dto.ESchoolYear; Closed = dto.Closed; ApplicationDomainId = dto.ApplicationDomainId; if (dto.Products != null) { dto.Products.ToList().ForEach(g => AddProduct(new Product(g))); } if (dto.Groups != null) { dto.Groups.ToList().ForEach(g => AddGroup(new Group(g, schoolId))); } Console.WriteLine(dto.EvaluationCritereas); if (dto.EvaluationCritereas != null) { dto.EvaluationCritereas.ToList().ForEach(g => { var ec = new EvaluationCriterea(g); Groups.ToList().ForEach(j => { j.AddEvaluation(new Evaluation { Group = j, EvaluationCriterea = ec }); }); AddEvaluationCriterea(ec); } ); } }
public void AddEvaluationCriterea(EvaluationCriterea p) { EvaluationCritereas.Add(p); }