Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143650 | Mar 29,2019 08:02 PM UTC | Mar 10,2020 04:34 AM UTC | ASP.NET Core - EJ 2 | 21 |
![]() |
Tags: Scheduler |
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);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.