public void PractitionerRepoGetAllReturnsCorrectCount() { //Arrange PractitionerRepository repository = new PractitionerRepository(); //Act var practitioners = repository.GetAll(); //Assert Assert.IsTrue(practitioners.Count == 10); }
public ActionResult <List <AppointmentViewModel> > SubmitForm(PractitionerPostViewModel formValues) { var appointments = appointmentRepository.GetByPractitionerIdsAndDateRange(formValues.ids, formValues.startDate, formValues.endDate); var practitioners = practitionerRepository.GetAll(); var newAppointments = from appointment in appointments join practitioner in practitioners on appointment.practitioner_id equals practitioner.id select new { appointment.id, appointment.Cost, appointment.Revenue, appointment.Date, appointment.practitioner_id, practitioner.Name, }; //Can we groupby practitioner then year/month? var result = newAppointments .GroupBy(x => (x.practitioner_id, x.Date.Year, x.Date.Month)) .Select(appointment => new AppointmentViewModel { id = appointment.First().id, practitionerName = appointment.First().Name, practitioner_id = appointment.First().practitioner_id, cost = appointment.Sum(c => c.Cost), revenue = appointment.Sum(r => r.Revenue), groupbyitems = appointment.Key.ToString(), }); if (result == null) { return(NotFound()); } return(result.ToList()); }
public ActionResult <List <Practitioner> > GetAll() { return(practitionerRepository.GetAll()); }