public int CancelAppointment(Appointment appointment) { using (RepositoryAppointment repositoryAppointment = new RepositoryAppointment()) { appointment.State = AppointmentEnumState.Cancel; repositoryAppointment.CUDOperation(appointment, EntityState.Modified); return(repositoryAppointment.SaveChanges()); } }
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); } }
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); } } }