我们有这个数据
models:"[{"timeTableId":5,"startTime":"2016-06-16T00:00:00","endTime":"2016-06-16T17:00:00","userId":31,"customerId":35}]"
使用api发送到asp.net webservice。
我们无法确定如何提取数据以进行操作,我们已经尝试过......
public IHttpActionResult PostTimeTable([FromBody]string models);// models is null
public IHttpActionResult PostTimeTable(string models);// models is null
public IHttpActionResult PostTimeTable([FromBody]List<TimetableView> models);// models is null
public IHttpActionResult PostTimeTable(IEnumerable<TimetableView> models);// models is null
TimetableView
public class TimetableView
{
public TimetableView(TimeTable timetable)
{
this.TimeTableId = timetable.TimeTableId;
this.StartTime = timetable.StartTime;
this.EndTime = timetable.EndTime;
this.UserId = timetable.UserId;
this.CustomerId = timetable.CustomerId ;
}
public TimetableView(){}
public int TimeTableId { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public int UserId { get; set; }
public int CustomerId { get; set; }
}
答案 0 :(得分:0)
试试这个
public IHttpActionResult PostTimeTable(
int timeTableId,
DateTiem startTime,
DateTime endTime,
int userId,
int customerId);
答案 1 :(得分:0)
我发现为什么这不是保存或获取正确的信息并解决了这个问题。 这是pastbin的链接:http://pastebin.com/p8HjFdeu