Exemplo n.º 1
0
        public Puppy CreatePuppy(Puppy puppy)
        {
            var pup = new Puppy()
            {
                Id      = puppy.Id,
                Name    = puppy.Name,
                Breed   = puppy.Breed,
                Age     = puppy.Age,
                OwnerId = puppy.OwnerId,
                Owner   = puppy.Owner,
            };

            _context.Puppies.Add(pup);
            _context.SaveChanges();
            return(pup);
        }
Exemplo n.º 2
0
        public Owner CreateOwner(Owner owner)
        {
            var newOwner = new Owner()
            {
                Id        = owner.Id,
                FirstName = owner.FirstName,
                LastName  = owner.LastName,
            };

            _context.Owners.Add(newOwner);
            _context.SaveChanges();
            return(newOwner);
        }