mardi 5 avril 2016

Ember.js with existing .NET Server App: what do I have to change to work well with Ember-Data?

After several attempts with Ember.js I am trying it again:

It's hard to catch up with the fast paced development - that's a good thing, right? Anyway, the current release version of Ember.js is obviously 2.4.4 (April 3rd).

To start some example of my own (using Ember-CLI), I want to consume the following service running on a server, written in C#:

namespace HDitem.ImageServer.api
{
    public class RnaInfo[..]
    public class ConnectionInfo[..]
    public class SubmissionInfo[..]
    public class SubmissionSetting[..]
    [RoutePrefix("api/rna")]
    [EnableCors("*", "*", "GET,PUT,POST,DELETE")]
    public class RnaController : ApiController
    {
        [..]

        /// <summary>View all</summary>
        /// <remarks>GET api/rna</remarks>
        [Route("")]
        public IEnumerable<string> Get()[..]

        /// <summary>View one</summary>
        /// <remarks>GET api/rna/Hannah1</remarks>
        [Route("{name}")]
        public SubmissionInfo Get(string name)[..]

        /// <summary>Update or Create</summary>
        /// <remarks>POST api/rna/ .. new item in body</remarks>
        [Route("{name}")]
        public HttpResponseMessage Post(string name, [FromBody]SubmissionInfo sInfo)[..]

        /// <summary>Create/Update</summary>
        /// <remarks>PUT api/rna .. new item in body</remarks>
        [Route("{name}")]
        public HttpResponseMessage Put(string name, [FromBody]SubmissionInfo sInfo)[..]

        /// <summary>Delete if it is there</summary>
        /// <remarks>DELETE api/Templates/pic/Bargain63internet</remarks>
        [Route("{name}")]
        public HttpResponseMessage Delete(string name)[..]
    }
}

Can anybody point me into a direction or tell me how my Ember-Data definition file would have to look like?




Aucun commentaire:

Enregistrer un commentaire