示例#1
0
 public virtual List <T> GetAll()
 {
     using (var context = new ClinicDbContext())
     {
         return(context.Set <T>().ToList());
     }
 }
 public override List <Appointment> GetAll()
 {
     using (var context = new ClinicDbContext())
     {
         return(context.Appointments.Include(a => a.Doctor).ToList());
     }
 }
示例#3
0
 public void Add(T item)
 {
     using (var context = new ClinicDbContext())
     {
         context.Set <T>().Add(item);
         context.SaveChanges();
     }
 }
示例#4
0
 public override List <OfficeHours> GetAll()
 {
     using (var context = new ClinicDbContext())
     {
         return(context.OfficeHours
                .Include(o => o.Doctor)
                .Include(o => o.Office)
                .ToList());
     }
 }
 public override List <Examination> GetAll()
 {
     using (var context = new ClinicDbContext())
     {
         return(context.Examinations
                .Include(a => a.Doctor)
                .Include(a => a.Office)
                .Include(a => a.Patient)
                .ToList());
     }
 }
 public void Add(string doctorName, DateTime startDateTime)
 {
     using (var context = new ClinicDbContext())
     {
         var doctor = context.Doctors.Single(d => d.Name == doctorName);
         context.Appointments.Add(new Appointment {
             Doctor = doctor, StartDate = startDateTime
         });
         context.SaveChanges();
     }
 }
示例#7
0
        public virtual List <T> Search(params Expression <Func <T, bool> >[] predicates)
        {
            using (var context = new ClinicDbContext())
            {
                IQueryable <T> results = context.Set <T>();

                foreach (var predicate in predicates)
                {
                    results = results.Where(predicate);
                }

                return(results.ToList());
            }
        }
        public override List <Appointment> Search(params Expression <Func <Appointment, bool> >[] predicates)
        {
            using (var context = new ClinicDbContext())
            {
                IQueryable <Appointment> results = context.Appointments
                                                   .Include(o => o.Doctor);

                foreach (var predicate in predicates)
                {
                    results = results.Where(predicate);
                }

                return(results.ToList());
            }
        }
示例#9
0
        public override List <OfficeHours> Search(params Expression <Func <OfficeHours, bool> >[] predicates)
        {
            using (var context = new ClinicDbContext())
            {
                IQueryable <OfficeHours> results = context.OfficeHours
                                                   .Include(o => o.Doctor)
                                                   .Include(o => o.Office);

                foreach (var predicate in predicates)
                {
                    results = results.Where(predicate);
                }

                return(results.ToList());
            }
        }
        public override List <Examination> Search(params Expression <Func <Examination, bool> >[] predicates)
        {
            using (var context = new ClinicDbContext())
            {
                IQueryable <Examination> results = context.Examinations
                                                   .Include(a => a.Doctor)
                                                   .Include(a => a.Office)
                                                   .Include(a => a.Patient);

                foreach (var predicate in predicates)
                {
                    results = results.Where(predicate);
                }

                return(results.ToList());
            }
        }
示例#11
0
 public void Add(string doctorName, string officeLocation, DayOfWeek dayOfWeek, TimeSpan startTime, TimeSpan endTime)
 {
     using (var context = new ClinicDbContext())
     {
         var doctor = context.Doctors.Single(d => d.Name == doctorName);
         var office = context.Offices.Single(o => o.Location == officeLocation);
         context.OfficeHours.Add(new OfficeHours
         {
             Doctor    = doctor,
             Office    = office,
             DayOfWeek = dayOfWeek,
             StartTime = startTime,
             EndTime   = endTime
         });
         context.SaveChanges();
     }
 }
 public void Add(string doctorName, string officeLocation, string patientName, DateTime startDateTime, DateTime endDateTime, decimal amountReceived)
 {
     using (var context = new ClinicDbContext())
     {
         var doctor  = context.Doctors.Single(d => d.Name == doctorName);
         var office  = context.Offices.Single(d => d.Location == officeLocation);
         var patient = context.Patients.Single(d => d.Name == patientName);
         context.Examinations.Add(new Examination
         {
             Doctor         = doctor,
             Office         = office,
             Patient        = patient,
             StartDateTime  = startDateTime,
             EndDateTime    = endDateTime,
             AmountReceived = amountReceived
         });
         context.SaveChanges();
     }
 }