2
I have this function to return the data in JSON, but I’m not able to make it work in MVC Core.
public ActionResult SalvarItens(string HoraInicio, string HoraFim, bool Seg, bool Ter, bool Qua, bool Qui, bool Sex, bool Sab, bool Dom, bool Fer, int Tipolimite, int Limiteacessos, int HorarioId)
{
var item = new HorariosItens()
{
HoraFim = HoraFim,
HoraInicio = HoraInicio,
Seg = Seg,
Ter = Ter,
Qua = Qua,
Qui = Qui,
Sex = Sex,
Sab = Sab,
Dom = Dom,
Fer = Fer,
Tipolimite = Tipolimite,
Limiteacessos = Limiteacessos,
HorarioId = HorarioId,
};
try
{
_context.HorariosItens.Add(item);
_context.SaveChanges();
}
catch (Exception ex)
{
throw ex;
}
//return Json(new { Resultado = item.Id }, JsonRequestBehavior.AllowGet);
}
This return Json(new { Resultado = item.Id }, JsonRequestBehavior.AllowGet);
does not work on MVC Core, how can I convert to work?
You don’t need the
JsonRequestBehavior.AllowGet
– Leandro Angelo
I work with Mvccore, this option does not appear to me.
– Mariana