Telerik aspx RadScheduler修改的约会未从原始约会修改

时间:2018-06-19 11:52:54

标签: c# telerik telerik-scheduler

所以我要更新约会。从字面上看,只是设置一个新的开始/结束日期和时间。

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
  是

在保存新更改时,数据库确认数据没有差异。

不确定从这里要去哪里。有人可以协助吗?

0 个答案:

没有答案