This is a slightly original variation on a common problem. I have a fairly simple model that looks like this:
public class Departure
{
public string Id { get; set; }
public Route Route { get; set; }
public TimeSpan Time { get; set; }
public string Timetable { get; set; }
public DayOfWeek[] ServicesRunning { get; set; }
public string Notes { get; set; }
}
I am posting a populated object back to the server but populating the array of DayOfWeek values is problematic. Integer values and strings aren't being correctly recognised so there must be a particular technique for doing this correctly but I haven't been able to work it out.
Any assistance would be much appreciated. The post method looks like this:
// POST /api/stops
[HttpPost]
public void Post(Departure dep)
{
Session.Store(dep);
}