public List <SysOperatorRole> GetRolesFromUI(SysOperator coreModel) { var result = new List <SysOperatorRole>(); SysOperatorRoleItems.FindAll(x => x.IsSelected).ForEach(x => { var role = coreModel.SysOperatorRoles.FirstOrDefault(r => r.RoleID == x.ID); if (role == null) { role = new SysOperatorRole() { OperatorID = OperatorID, RoleID = x.ID }; } result.Add(role); }); return(result); }
public void BindUI(SysOperator coreModel) { if (OperatorID == 0) { LanguageID = 2052; NewPasswordEnabled = true; Status = true; } else { Status = coreModel.Status == GeneralStatus.Enabled; coreModel.SysOperatorRoles.ForEach(x => { var item = SysOperatorRoleItems.FirstOrDefault(i => i.ID == x.RoleID); if (item != null) { item.IsSelected = true; } }); } }