public Yield GetGroups(DreamContext context, DreamMessage request, Result <DreamMessage> response) { PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.READ); uint totalCount, queryCount; IList <GroupBE> groups = GroupBL.GetGroupsByQuery(context, out totalCount, out queryCount); XDoc result = new XDoc("groups"); result.Attr("count", groups.Count); result.Attr("querycount", queryCount); result.Attr("totalcount", totalCount); result.Attr("href", DekiContext.Current.ApiUri.At("groups")); foreach (GroupBE g in groups) { result.Add(GroupBL.GetGroupXmlVerbose(g, null)); } response.Return(DreamMessage.Ok(result)); yield break; }