static void InsertAppointments(EmlakSistemi.Models.EmlakContext appointmentContext, object resourceContext)
        {
            var appointments = appointmentContext.Randevu.ToList();

            System.Collections.IEnumerable resources = null;

            var newAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToInsert <EmlakSistemi.Models.Randevu>("Scheduler", appointments, resources,
                                                                                                                              AppointmentStorage, ResourceStorage);

            foreach (var appointment in newAppointments)
            {
                appointmentContext.Randevu.Add(appointment);
            }
            appointmentContext.SaveChanges();
        }
        static void UpdateAppointments(EmlakSistemi.Models.EmlakContext appointmentContext, object resourceContext)
        {
            var appointments = appointmentContext.Randevu.ToList();

            System.Collections.IEnumerable resources = null;

            var updAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToUpdate <EmlakSistemi.Models.Randevu>("Scheduler", appointments, resources,
                                                                                                                              AppointmentStorage, ResourceStorage);

            foreach (var appointment in updAppointments)
            {
                var origAppointment = appointments.FirstOrDefault(a => a.Randevu_ID == appointment.Randevu_ID);
                appointmentContext.Entry(origAppointment).CurrentValues.SetValues(appointment);
            }
            appointmentContext.SaveChanges();
        }
        static void DeleteAppointments(EmlakSistemi.Models.EmlakContext appointmentContext, object resourceContext)
        {
            var appointments = appointmentContext.Randevu.ToList();

            System.Collections.IEnumerable resources = null;

            var delAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToRemove <EmlakSistemi.Models.Randevu>("Scheduler", appointments, resources,
                                                                                                                              AppointmentStorage, ResourceStorage);

            foreach (var appointment in delAppointments)
            {
                var delAppointment = appointments.FirstOrDefault(a => a.Randevu_ID == appointment.Randevu_ID);
                if (delAppointment != null)
                {
                    appointmentContext.Randevu.Remove(delAppointment);
                }
            }
            appointmentContext.SaveChanges();
        }
 public static void UpdateEditableDataObject(EmlakSistemi.Models.EmlakContext appointmentContext, object resourceContext)
 {
     InsertAppointments(appointmentContext, resourceContext);
     UpdateAppointments(appointmentContext, resourceContext);
     DeleteAppointments(appointmentContext, resourceContext);
 }