所以我要更新约会。从字面上看,只是设置一个新的开始/结束日期和时间。
protected void RadScheduler_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)
{
int.TryParse(e.Appointment.ID.ToString(), out int appointmentId);
using (var db = new ApplicationDbContext())
{
// Update the record in the database.
var appointment = db.Appointments.Single(x => x.AppointmentID == appointmentId);
appointment.StartTime = e.ModifiedAppointment.Start;
appointment.EndTime = e.ModifiedAppointment.Start.AddHours(1);
db.SubmitChanges();
}
// Update the appointment in the Scheduler's collection.
var existing = Appointments.Single(x => x.AppointmentID == appointmentId);
existing.StartTime = e.ModifiedAppointment.Start;
existing.EndTime = e.ModifiedAppointment.Start.AddHours(1);
}
不幸的是,新约会的详细信息似乎没有正确存储。这是我在即时窗口中执行的操作:
appointment.StartTime == e.ModifiedAppointment.Start
是
在保存新更改时,数据库确认数据没有差异。
不确定从这里要去哪里。有人可以协助吗?