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); }
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); }
public void Add(ToDoItem newItem) { _ptx.ToDoItems.Add(newItem); _ptx.SaveChanges(); }
public void Add(User newUser) { _ptx.Users.Add(newUser); _ptx.SaveChanges(); }
public Pet Create(Pet createPet) { _ptx.Attach(createPet).State = EntityState.Added; _ptx.SaveChanges(); return(createPet); }