Ejemplo n.º 1
0
 public Pet CreatePet(Pet pet)
 {
     /*if (pet.Owner != null)
      * {
      *  _ctx.Attach(pet.Owner);
      * }
      *
      * var saved = _ctx.Pets.Add(pet).Entity;
      * _ctx.SaveChanges();
      * return saved;*/
     _ctx.Attach(pet).State = EntityState.Added;
     _ctx.SaveChanges();
     return(pet);
 }
 public Owner CreateOwner(Owner owner)
 {
     _ctx.Attach(owner).State = EntityState.Added;
     _ctx.SaveChanges();
     return(owner);
 }