public void SaveSkills(long id = 0) { SkillsToAdd.ForEach(s => { if (SkillsToDelete.Any(sd => sd == s)) { return; } if (id != 0) { s.ProjectId = id; } DBModel.Context.Insert(s); }); SkillsToDelete.ForEach(s => { if (s.ProjectId != 0) { DBModel.EmployeesDB.Delete(s); } }); }
public void UpdateSkills() { var skills = new List <ProjectRequiredSkill>(); if (!Requiredskillsidfks.IsEmpty() && !SkillsToAdd.IsEmpty()) { skills = Requiredskillsidfks.Union(SkillsToAdd).ToList(); } else if (!Requiredskillsidfks.IsEmpty()) { skills = Requiredskillsidfks.ToList(); } else if (!SkillsToAdd.IsEmpty()) { skills = SkillsToAdd; } Skills = new ObservableCollection <ProjectRequiredSkill>( skills.Where(rs => !SkillsToDelete.Any(s => s == rs)) ); RaisePropertyChanged(nameof(Skills)); }
public void UpdateSkills() { var skills = new List <EmployeeSkill>(); if (!Skillidfks.IsEmpty() && !SkillsToAdd.IsEmpty()) { skills = Skillidfks.Union(SkillsToAdd).ToList(); } else if (!Skillidfks.IsEmpty()) { skills = Skillidfks.ToList(); } else if (!SkillsToAdd.IsEmpty()) { skills = SkillsToAdd; } Skills = new ObservableCollection <EmployeeSkill>( skills.Where(es => !SkillsToDelete.Any(s => s == es)) ); RaisePropertyChanged(nameof(Skills)); }