partial void DeleteECCAppointment(ECCAppointment instance);
 partial void UpdateECCAppointment(ECCAppointment instance);
 public static void DeleteAppointment(ECCAppointment model)
 {
     Repository.ECCAppointments.DeleteOnSubmit(model);
     Repository.SubmitChanges();
 }
 partial void InsertECCAppointment(ECCAppointment instance);
 public static void SaveAppointment(ECCAppointmentsViewModel viewModel)
 {
     var model = Repository.ECCAppointments.Where(c => c.FromDate == viewModel.Date).SingleOrDefault();
     if (model != null)
     {
         model.AppointmentName = viewModel.AppointmentName;
         model.FromDate = viewModel.Date;
         model.AptDate = viewModel.Date.Day + "-" + viewModel.Date.Month + "-" + viewModel.Date.Year; 
         Repository.SubmitChanges();
     }
     else
     {
         var newModel = new ECCAppointment();
         newModel.AppointmentName = viewModel.AppointmentName;
         newModel.FromDate = viewModel.Date;
         newModel.AptDate = viewModel.Date.Day + "-" + viewModel.Date.Month + "-" + viewModel.Date.Year;
         Repository.ECCAppointments.InsertOnSubmit(newModel);
         Repository.SubmitChanges();
     }
 }