private void GetData() { RepositoryContext db = new RepositoryContext("RepositoryContext"); AnimalRepository animalRepo = new AnimalRepository(db); OwnerRepository ownerRepo = new OwnerRepository(db); VetRepository vetRepo = new VetRepository(db); VisitRepository visitRepo = new VisitRepository(db); var animalList = animalRepo.All().ToList(); dataGridViewAnimals.DataSource = animalList; //comboBoxAnimals.DataSource = animalList; var ownerList = ownerRepo.All().ToList(); dataGridViewOwners.DataSource = ownerList; comboBoxOwnerList.DataSource = ownerList; comboBoxOwnersFromVisit.DataSource = ownerList; var vetList = vetRepo.All().ToList(); dataGridViewVets.DataSource = vetList; comboBoxVets.DataSource = vetList; var visitList = visitRepo.All().ToList(); dataGridViewVisits.DataSource = visitList; }
// GET: Animals/PetForm public ActionResult PetForm(string biteId, string petId) { var PetFormViewModel = new AnimalViewModel { Animal = new Animal(biteId), Breeds = _breedRepository.All(), Specieses = _speciesRepository.All(), Employees = _employeeRepository.All(), Vets = _vetRepository.All() }; if (petId != null) { PetFormViewModel.Animal = _animalRepository.GetById(petId).Result; } return(View(PetFormViewModel)); }
// GET: Vets public async Task <ActionResult> Index() { var vets = _vetRepository.All(); return(View(await vets.ToListAsync())); }