I have method in controller:
[HttpPost("add")]
public async Task<IActionResult> Post([FromBody]IEnumerable<TrainingModel> model)
I have model TrainingModel
:
public class TrainingModel
{
public int TrainingId { get; set; }
public string Name { get; set; }
public float Distance { get; set; }
public int ElapsedTime { get; set; }
public DateTime Date { get; set; }
public string MapPolyline { get; set; }
public int UserId { get; set; }
}
Was a problem with TrainingId
property, given value for this property caused an overflow. Thanks for your help.
I ran into similar issue. For me it was because for some reason the model I was trying to deserialize into did not contain [DataContract] [DataMember] attributes. Once I added those in everything deserialized as expected:
[DataContract]
public class PersonViewModel
{
[DataMember(Name = "address", EmitDefaultValue = true)]
public string Address { get; set; }
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.