I have method to add new item to db from ajax call
Here is back-end method
public ActionResult AddingInternalAppointment(string Start, string End, string Title, DateTime appointmentDate,int id)
{
using (var ctx = new ApplicationDbContext())
{
Appointment appointmentInt = new Appointment()
{
Start_appointment = Start,
End_appointment = End,
Title = Title,
Type_of_appointment = "Internal",
Date = appointmentDate
};
ctx.Appointments.Add(appointmentInt);
ctx.SaveChanges();
return Json(new {Result = "Success", Message = "Saved Successfully"});
}
I need to get id of created item and write it to variable.
How I can do this?