This is a migrated thread and some comments may be shown as answers.

So I can't use the [FromBody] parameter in the transports for datasources

3 Answers 490 Views
Grid
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 20 May 2014, 05:55 PM
    In WebAPI: 
        [HttpDelete]
        [Route("AccountDel")]
        public void DeleteAccount([FromBody]Account account)
        {
...

So I can't call that from a (Or could a put a jquery ajax call in there): 
                    destroy: {
                        type: "DELETE",
                        url: function (options) {
                            return '/api/FlossAccount/AccountDel';
                        },
                        dataType: "json",
                       data:  function (options) {
                            return { '': options.models[0]};
                         },
                        cache: false
                    },  



3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 May 2014, 02:10 PM
Hello Dan,

You have included this as a field with out a name, also you might need to use ToJSON method of the model.

data:  function (options) {
return options.models[0].ToJSON();
},

You should be able to make it work according to this post.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Petur Subev
Telerik team
answered on 22 May 2014, 02:44 PM
Hello again Dan,

We have a GitHub repository with examples which demonstrates how to configure your DataSource to work with the API controller.

https://github.com/telerik/kendo-examples-asp-net/tree/master/grid-webapi-crud

I hope this helps.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
danparker276
Top achievements
Rank 2
answered on 22 May 2014, 03:01 PM
Ok, I can do it like the example too, but it's not using [FromBody] like a regular ajax call would.  That's fine, I'll just do it like the example.
Tags
Grid
Asked by
danparker276
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
danparker276
Top achievements
Rank 2
Share this question
or