嵌套参数AFNetworking

时间:2014-01-10 21:35:17

标签: ios afnetworking

如何使用AFNetworking发布嵌套参数?我无法将类型对象作为故事对象的嵌套对象发送。它应该自动映射到StoryViewModel的Genre属性,但它不会。

[self POST:@"Stories/CreateStory" parameters:@{@"Title":story.title,@"Abstract":story.abstract
                                                   ,@"UserId":[NSNumber numberWithInteger:story.userId],
                                                   @"Genre":[story.genre toDictionary] 


// The action is defined below: 

 public JsonResult CreateStory(StoryViewModel storyViewModel)

 public class StoryViewModel
    {
        public int StoryId { get; set; }
        public int UserId { get; set; }
        public string Title { get; set; }
        public string Abstract { get; set; }
        public bool IsFeatured { get; set; }
        public GenreViewModel Genre { get; set; }
    }

0 个答案:

没有答案