private void AddEditSkillCategory_Load(object sender, EventArgs e) { var unitofwork = new UnitOfWork(); if(currentSkillCategoryId!=null) { currentSkillCategory = unitofwork.SkillCategoryRepository.Get(x => x.Id == currentSkillCategoryId,includeProperties:"Paremt").FirstOrDefault(); txtName.Text = currentSkillCategory.Name; txtNotes.Text = currentSkillCategory.Notes; if(currentSkillCategory.Paremt!=null) parentSkillCategoryId = currentSkillCategory.Paremt.Id; } if(parentSkillCategoryId!=null) { lblParent.Text= unitofwork.SkillCategoryRepository.Get(x => x.Id == parentSkillCategoryId).FirstOrDefault().Name; } else { lblParent.Text = ""; } }
private SkillCategory GetFields(SkillCategory work,SkillCategory parent) { work.Name = txtName.Text; work.Notes = txtNotes.Text; work.Paremt = parent; return work; }