public void SaveNewDog(DogFM fm) { Dog dog = new Dog(); dog.Name = fm.Name; dog.Age = fm.Age; using (UnitOfWork uow = new UnitOfWork()) { Breed breed = uow.GetBreedDAO().GetBreedById(fm.BreedId); uow.GetDogDAO().CreateDog(dog, breed); } }
public void UpdateDog(DogFM fm) { using (UnitOfWork uow = new UnitOfWork()) { Dog dog = uow.GetDogDAO().GetDogById(fm.Id); dog.Name = fm.Name; dog.Age = fm.Age; uow.GetDogDAO().UpdateDog(dog); Breed breed = uow.GetBreedDAO().GetBreedById(fm.BreedId); uow.GetDogDAO().UpdateDogBreed(dog, breed); } }