public static RoleModelMVC RoleModelBLToRoleModelDA(RoleModelBL role) { var newRole = new RoleModelMVC() { Id = role.Id, Name = role.Name, //Users = new List<UserModelMVC>() }; if (role.Users == null) { return(newRole); } newRole.Users = new List <UserModelMVC>(); role.Users.ToList().ForEach(s => newRole.Users.Add(new UserModelMVC { Id = s.Id, Login = s.Login, Password = s.Password, IsActive = s.IsActive })); return(newRole); }
public bool CreateRole(RoleModelBL role) { var newRole = _roleRepository.GetRoleByName(role.Name); if (newRole != null) { return(false); } _roleRepository.Create(RoleMapBL.RoleModelBLToRoleModelDA(role)); return(true); }