/// <summary> /// Deprecated Method for adding a new object to the wsQPets EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTowsQPets(wsQPet wsQPet) { base.AddObject("wsQPets", wsQPet); }
public void SavePet(Pet pet, int custId) { wsQPet dbPet = null; bool bAdd = false; if (pet.PetId == 0) { dbPet = new wsQPet(); bAdd = true; dbPet.CreateDate = DateTime.Now; } else dbPet = GetPetById(pet.PetId); if (dbPet != null) { dbPet.Birthdate = pet.Birthday; dbPet.BreedId = pet.BreedId; dbPet.BreedName = pet.BreedName; dbPet.ColorId = pet.ColorId; dbPet.ColorName = pet.ColorName; dbPet.PetName = pet.PetName; dbPet.Gender = pet.Gender; dbPet.QCustomerID = custId; dbPet.QPlanID = pet.QPlanId; dbPet.SpayedOrNeutered = pet.SpayedOrNeutered; dbPet.SpeciesId = pet.SpeciesId; dbPet.SpeciesName = pet.SpeciesName; dbPet.WeightId = pet.WeightId; if(!bAdd) dbPet.ModifyDate = DateTime.Now; else context.wsQPets.AddObject(dbPet); context.SaveChanges(); if (pet.PetId == 0) pet.PetId = dbPet.QPetID; } }
/// <summary> /// Create a new wsQPet object. /// </summary> /// <param name="qPetID">Initial value of the QPetID property.</param> /// <param name="qCustomerID">Initial value of the QCustomerID property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> public static wsQPet CreatewsQPet(global::System.Int32 qPetID, global::System.Int32 qCustomerID, global::System.DateTime createDate) { wsQPet wsQPet = new wsQPet(); wsQPet.QPetID = qPetID; wsQPet.QCustomerID = qCustomerID; wsQPet.CreateDate = createDate; return wsQPet; }