Example #1
0
 public int CancelAppointment(Appointment appointment)
 {
     using (RepositoryAppointment repositoryAppointment = new RepositoryAppointment())
     {
         appointment.State = AppointmentEnumState.Cancel;
         repositoryAppointment.CUDOperation(appointment, EntityState.Modified);
         return(repositoryAppointment.SaveChanges());
     }
 }
Example #2
0
 public int FillAppointmentInfo(Appointment appointment, AppointmentEnumState state)
 {
     if (appointment != null)
     {
         using (RepositoryAppointment repositoryAppointment = new RepositoryAppointment())
         {
             appointment.State      = state;
             appointment.UpdateTime = DateTime.Now;
             repositoryAppointment.CUDOperation(appointment, EntityState.Modified);
             return(repositoryAppointment.SaveChanges());
         }
     }
     else
     {
         return(-1);
     }
 }
Example #3
0
 public int SetNewAppointment(DateTime dateTime, Member member, Doctor doctor, Hospital hospital)
 {
     using (RepositoryAppointment repositoryAppointment = new RepositoryAppointment())
     {
         if (!repositoryAppointment.AnyWithExplicitLoad(I => I.Time == dateTime && I.DoctorId == doctor.Id && I.HospitalId == hospital.Id))
         {
             repositoryAppointment.CUDOperation(new Appointment()
             {
                 Id         = Guid.NewGuid(),
                 Time       = dateTime,
                 MemberId   = member.Id,
                 DoctorId   = doctor.Id,
                 HospitalId = hospital.Id
             }, EntityState.Added);
             return(repositoryAppointment.SaveChanges());
         }
         else
         {
             return(-2);
         }
     }
 }