JsonRequestBehavior
has been deprecated in ASP.NET Core 1.0.
public async Task GetData()
{
var schedule = await GetScheduleData(DateTime.Now.ToString("dd/MM/yyyy"), null, User.Identity.Name);
return Json(schedule);
}
|
public JsonResult CrudData ([FromBody]EditParams param)
public class EditParams
{
public string key { get; set; }
public string action { get; set; }
public List<ScheduleEvent> added { get; set; }
public List<ScheduleEvent> changed { get; set; }
public List<ScheduleEvent> deleted { get; set; }
public ScheduleEvent value { get; set; }
} |
Hi Gregory,Thanks for your update.Please try using [FromBody] like below.
public JsonResult CrudData ([FromBody]EditParams param)public class EditParams{public string key { get; set; }public string action { get; set; }public List<ScheduleEvent> added { get; set; }public List<ScheduleEvent> changed { get; set; }public List<ScheduleEvent> deleted { get; set; }public ScheduleEvent value { get; set; }}Regards,Karthi
using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
public void ConfigureServices(IServiceCollection services) {
services.AddDbContext<ScheduleDataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ScheduleDataConnection")));
services.AddMvc(option => option.EnableEndpointRouting = false).AddNewtonsoftJson();
services.AddMvc()
.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver())
.AddNewtonsoftJson(opt => opt.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat)
.AddNewtonsoftJson(opt => opt.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local);
} |