我有一个json数据。
目标:我想将json数据从视图传递到aspnetcore控制器,类似
public class MyClass {
public synchronized void instanceMethod() {
// This method will synchronize on the instance of MyClass that called it
}
public static synchronized void staticMethod() {
// This method will synchronize on MyClass.class
}
}
但没有成功!..
模型是:
public IActionResult(PRICES[] things)
{
}
JSON数据为:
public class PRICES :IEntity
{
public int ID { get; set; }
public decimal? PRICE { get; set; }
public decimal? PRICE2 { get; set; }
public decimal? PRICE3 { get; set; }
public decimal? PRICE4 { get; set; }
}
花了4-5个小时,没有成功。任何回应都会引起重视。
答案 0 :(得分:0)
您的操作方法接受一个数组。PRICES[] things
。但是您正在发送Json对象。
删除things
部分,仅发送[{},{}]
。即发送一个json数组。
或重构操作方法以接受
之类的对象public class Things
{
public IList<PRICES> Things { get; set; }
}
}