Exemple #1
0
        public async Task <IActionResult> Edit(Guid dogId, Guid shelterId)
        {
            IEnumerable <Shelter> shelters = await _shelterRepo.GetAll();

            ViewBag.shelters = shelters;

            ViewBag.shelterId = shelterId;
            if (dogId.Equals(Guid.Empty))
            {
                return(View(new Dog()));
            }
            else
            {
                return(View(await _dogRepo.GetById(dogId)));
            }
        }
        public void when_creating_a_dog()
        {
            // TODO: Use a registry to do this.
            new DogMapper().RegisterClassMaps();
            new AggregateRootMapper().RegisterClassMaps();

            var dog = new Dog()
                          {
                              Name = "Dog 1"
                          };

            var dogRepository = new DogRepository(new Repository(database),
                                                  database.GetCollection<Dog>(typeof (Dog).Name));

            dogRepository.CreateDogAggregate(dog);

            var dogQ = dogRepository.GetById(dog.Identity);
            Assert.AreNotEqual(dogQ, dog); // Just to make sure we pulled it from the db
            Assert.AreEqual(dogQ.Name, dog.Name);
        }
Exemple #3
0
 public IActionResult Edit(int id)
 {
     return(View(_repository.GetById(id)));
 }