我有从ajax调用
向db添加新项的方法这是后端方法
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"});
}
我需要获取已创建项目的ID并将其写入变量。
我怎么能这样做?