示例#1
0
 public ActionResult EditingPartialEditAppointment()
 {
     try {
         SchedulerDataHelper.UpdateEditableDataObject();
     }
     catch (Exception e) {
         ViewData["SchedulerErrorText"] = e.Message;
     }
     return(PartialView("EditingPartial", SchedulerDataHelper.EditableDataObject));
 }
        void RemoveAppointments()
        {
            if (!ModelState.IsValid)
            {
                return;
            }

            ValidationSchedule[] schedules = SchedulerDataHelper.GetAppointmentsToRemove <ValidationSchedule>(
                SchedulerDataHelper.CustomDataObject, SchedulerDemoHelper.CustomAppointmentStorage);
            foreach (var schedule in schedules)
            {
                CarsDataProvider.DeleteCarScheduling <ValidationSchedule>(schedule);
            }
        }
        void InsertAppointment()
        {
            ValidationSchedule schedule = SchedulerDataHelper.GetAppointmentToInsert <ValidationSchedule>(
                SchedulerDataHelper.CustomDataObject, SchedulerDemoHelper.CustomAppointmentStorage);

            if (schedule != null && TryValidateModel(schedule))
            {
                CarsDataProvider.InsertSchedule <ValidationSchedule>(schedule);
            }
            else
            {
                ViewData["EditableSchedule"] = schedule;
            }
        }
        void UpdateAppointment()
        {
            if (!ModelState.IsValid)
            {
                return;
            }

            ValidationSchedule[] schedules = SchedulerDataHelper.GetAppointmentsToUpdate <ValidationSchedule>(
                SchedulerDataHelper.CustomDataObject, SchedulerDemoHelper.CustomAppointmentStorage);
            foreach (var schedule in schedules)
            {
                if (!TryValidateModel(schedule))
                {
                    ViewData["EditableSchedule"] = schedule;
                    break;
                }
                CarsDataProvider.UpdateSchedule <ValidationSchedule>(schedule);
            }
        }