Skip to content

Passing a Dictionary as part of request #69

@Evert1976

Description

@Evert1976

Hi,

I have this API Controller in ASPNET MVC:

public void Post([FromBody] Request request)
//...

with this request model:

public class Request
{
        public int ScenarioLocationID { get; set; }
        public int StoreLocationID { get; set; }
        public int VersionID { get; set; }
        public Dictionary<string, string> Properties { get; set; }
}

But when I try to do the following in Javascript. The Properties property has always a length of 0. Before I used the webapiproxy generator it worker ok.

var properties = {};
ko.utils.arrayForEach(self.properties(), function (impactProperty) {
    properties[impactProperty.name] = impactProperty.value;
});

var request = { 
    VersionID: self.versionID, 
    ScenarioLocationID: self.scenarioLocationId(), 
    StoreLocationID: self.storeLocationId(), 
    Properties: properties 
};

$.proxies.controller.post(request).done(function (data) {
//...

Thanks in advance,

Evert

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions