public PetType AddNewPetType(PetType newPetType)
        {
            var thePetType = _ptx.PetTypes.Add(newPetType).Entity;

            _ptx.SaveChanges();
            return(thePetType);
        }
        public PetColor CreatePetColor(PetColor newPetColor)
        {
            var petColor = _ptx.Add(newPetColor).Entity;

            _ptx.SaveChanges();
            return(petColor);
        }
Ejemplo n.º 3
0
 public Owner Create(Owner owner)
 {
     //if (owner.OwnerPets !=null && _ptx.ChangeTracker.Entries<Pet>().FirstOrDefault(ce => ce.Entity.Id == owner.Id) == null)
     //{
     //    _ptx.Attach(owner.OwnerPets);
     //}
     //var saved = _ptx.Owners.Add(owner).Entity;
     //_ptx.SaveChanges();
     //return saved;
     _ptx.Attach(owner).State = EntityState.Added;
     _ptx.SaveChanges();
     return(owner);
 }
Ejemplo n.º 4
0
 public void Add(ToDoItem newItem)
 {
     _ptx.ToDoItems.Add(newItem);
     _ptx.SaveChanges();
 }
Ejemplo n.º 5
0
 public void Add(User newUser)
 {
     _ptx.Users.Add(newUser);
     _ptx.SaveChanges();
 }
Ejemplo n.º 6
0
 public Pet Create(Pet createPet)
 {
     _ptx.Attach(createPet).State = EntityState.Added;
     _ptx.SaveChanges();
     return(createPet);
 }