0
是否有任何方法來修改ModelState屬性的鍵?我收到以下JSON響應:修改ModelState MVC屬性的鍵/值對
{"Message":"The request is invalid.",
"ModelState":
{
"supplier.SupplierWarehouses[2].Location":["Location name is too long, maximum 50 characters"]
}
}
我想修改supplier.SupplierWarehouses [2] .Location的東西更簡單的像SupplierLocation。
有什麼辦法可以直接在模型中做到這一點?我目前的型號是:
public class SupplierWarehouseMetadata
{
[StringLength(50,ErrorMessage="Location name is too long, maximum 50 characters")]
public string Location { get; set; }
}