Web API PUT/POST/DELETE not working

Jun 16, 2012 at 8:27 PM

Is anybody else having an issue with PUT/POST/DELETE not working in the Web API Project?  The issue I'm having is when calling CommandBus.Submit(command) and when it tries to resolve the associated handler via the DependencyResolver, it comes back null.

There's an issue posted for this, but I wanted to see if anybody has successfully got the API to work?

http://efmvc.codeplex.com/workitem/15152

Thanks,

David

Jun 18, 2012 at 1:48 AM

$(function () {
    $("a.delete").live('click', function () {
        //data() 方法向被选元素附加数据,或者从被选元素获取数据。
        var id = $(this).data('comment-id');
        $.ajax({
            url: "/api/comments/" + id,
            type: 'DELETE',
            cache: false,
            statusCode: {
                200: function (data) {
                    //JavaScript中Remove函数方法是从一个 Dictionary 对象中删除一个主键,条目对。使用方法:object.Remove(key)
                   
                    viewModel.comments.remove(
                        function (comment) {
                            return comment.ID == data.ID;
                        }
                    );
                }
            }
        });

        return false;
    });
});

 

 

is it?