예제 #1
0
        private List <BreedVM> GetBreedVMs(UnitOfWork uow)
        {
            List <BreedVM> breeds = new List <BreedVM>();

            foreach (Breed breed in uow.GetBreedDAO().GetAllBreeds())
            {
                BreedVM breedVM = new BreedVM();
                breedVM.Id   = breed.Id;
                breedVM.Type = breed.Type;
                breeds.Add(breedVM);
            }
            return(breeds);
        }
예제 #2
0
        public EditDogVM GetEditDogVM(int id)
        {
            EditDogVM vm = new EditDogVM();

            using (UnitOfWork uow = new UnitOfWork())
            {
                vm.Breeds = GetBreedVMs(uow);
                DogVM dogVM = new DogVM();
                Dog   dog   = uow.GetDogDAO().GetDogById(id);
                dogVM.Id   = id;
                dogVM.Age  = dog.Age;
                dogVM.Name = dog.Name;
                BreedVM breedVM = new BreedVM();
                Breed   breed   = uow.GetBreedDAO().GetBreedByDog(dog);
                breedVM.Id   = breed.Id;
                breedVM.Type = breed.Type;
                vm.Dog       = dogVM;
                vm.Breed     = breedVM;
            }
            return(vm);
        }