public Lib.Models.Permissions Map(Models.Permissions permissions) { if (permissions == null) { return(null); } try { return(mappedPermissions[permissions.Id]); } catch { var newPerm = new Lib.Models.Permissions() { Id = permissions.Id, Author = (permissions.Author == null) ? new Lib.Models.Identity() { Id = permissions.AuthorId } : Map(permissions.Author), Perms = Map(permissions.Perms), Revealed = Map(permissions.Revealeds) }; mappedPermissions[permissions.Id] = newPerm; return(newPerm); } }
public Models.Permissions Map(Lib.Models.Permissions permissions) { if (permissions == null) { return(null); } return(new Models.Permissions() { Id = permissions.Id, AuthorId = (permissions.Author?.Id != null)? (int)permissions.Author?.Id : 0, Author = (permissions.Author?.Id == 0) ? Map(permissions.Author) : null, Perms = Map(permissions.Perms), Revealeds = Map(permissions.Revealed) }); }