示例#1
0
        private Object GetAllGroupsResponse()
        {
            var groups = _contactService.GetAllGroups().OrderBy(g => g.Name).Select(g => new
            {
                id       = g.Id,
                name     = g.Name,
                contacts = _contactService.GetContactsByGroup(g).OrderBy(p => p.FullName).
                           Select(p => new { id = p.Id, name = p.FullName })
                           .ToList()
            }).ToList();

            var data = new
            {
                groups
            };

            return(data);
        }