Try to implement Wep API in Orchard but return empty

Topics: Administration, Customizing Orchard, Troubleshooting, Writing modules
Aug 26, 2013 at 9:16 AM
I try to implement api in orchard 1.7 as below

Model
using System;
using Orchard.ContentManagement.Records;

namespace Ective.NGame.Models
{
    public class NGroupPartRecord : ContentPartRecord
    {
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
    }
}
using System;
using Orchard.ContentManagement;
using System.ComponentModel.DataAnnotations;


namespace Ective.NGame.Models
{
    public class NGroupPart : ContentPart<NGroupPartRecord>
    {
        [Required]
        public string Name
        {
            get { return Record.Name; }
            set { Record.Name = value; }
        }

        public string Description
        {
            get { return Record.Description; }
            set { Record.Description = value; }
        }
    }
}
Controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Orchard.ContentManagement;
using Ective.NGame.Models ; 
using Ective.NGame.Services ; 

namespace Ective.NGame.Controllers
{
    public class GroupServiceController : ApiController
    {
        private readonly   INGroupService _nGroupServices;
        public GroupServiceController(INGroupService nGroupService)
        {
            _nGroupServices = nGroupService;
        }

      // GET api/<controller>
        public IEnumerable<NGroupPart> Get()
        {
            return _nGroupServices.GetNGroup().List<NGroupPart>(); 
        }
    }
}
Service
using Orchard;
using Ective.NGame.Models;
using Orchard.ContentManagement; 

namespace Ective.NGame.Services
{
    public interface INGroupService :IDependency
    {
        NGroupPart CreateNGroup(string name, string description);
        NGroupPart GetNGroupByName(string name);
        IContentQuery<NGroupPart> GetNGroup();
        NGroupPart GetNGroup(int id);
        bool VerifyNGroupUnicity(int id, string name);
    }
}
using Orchard;
using Orchard.ContentManagement;
using Orchard.Security;
using Orchard.Services;
using System.Linq;
using Ective.NGame.Models; 

namespace Ective.NGame.Services
{
    public class NGroupService :INGroupService
    {
        private readonly IOrchardServices _orchardServices;

        public NGroupService(IOrchardServices orchardServices)
        {
            _orchardServices = orchardServices;
        }

        public NGroupPart CreateNGroup(string name, string description)
        {
            //return _orchardServices.ContentManager.Create<NGroupPart>("NGroupPart", x =>
            //{
            //    x.Name = name;
            //    x.Description = description;
            //});

            var nGroup = _orchardServices.ContentManager.New("NGroup");
            var nGroupPart = nGroup.As<NGroupPart>();
            nGroupPart.Name = name;
            nGroupPart.Description = description;
            _orchardServices.ContentManager.Create (nGroup);
            return nGroupPart; 
        }

        public IContentQuery<NGroupPart> GetNGroup()
        {
            return _orchardServices.ContentManager.Query<NGroupPart, NGroupPartRecord>();
        }




        public NGroupPart GetNGroup(int id)
        {
            return _orchardServices.ContentManager.Get<NGroupPart>(id);
        }


        public NGroupPart GetNGroupByName(string name)
        {
            return _orchardServices.ContentManager.Query<NGroupPart, NGroupPartRecord>().Where(x => x.Name == name).List().FirstOrDefault();
        }


        public bool VerifyNGroupUnicity(int id, string name)
        {
        

            if (_orchardServices.ContentManager.Query<NGroupPart, NGroupPartRecord>()
                                   .Where(x =>
                                          x.Name == name)
                                   .List().Any(x => x.Id != id))
            {
                return false;
            }

            return true;
        }
    }
}
ROUTE
using System.Collections.Generic;
using Orchard.Mvc.Routes;
using Orchard.WebApi.Routes;

namespace Ective.NGame
{
    public class HttpRoutes : IHttpRouteProvider
    {
        public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[] {
                new HttpRouteDescriptor() {
                    Name = "GroupService",
                    Priority = -10,
                    RouteTemplate = "Group",
                    Defaults = new {
                        area = "Ective.NGame",
                        controller = "GroupService",
                        action ="Get"
                    }
                }

            };
        }

        public void GetRoutes(ICollection<RouteDescriptor> routes)
        {
            foreach (var routeDescriptor in this.GetRoutes())
                routes.Add(routeDescriptor);

        }
    }
}
I try to trace the code , it success run but i get a [{},{}] return in the file.
How to i map the end result
 // GET api/<controller>
    public IEnumerable<NGroupPart> Get()
    {
        return _nGroupServices.GetNGroup().List<NGroupPart>(); 
    }
so that i can get the data on name and desciption ?