/// <summary> /// Create a new Contact object. /// </summary> /// <param name="idContact">Initial value of the idContact property.</param> /// <param name="telefon">Initial value of the telefon property.</param> /// <param name="email">Initial value of the email property.</param> /// <param name="numeProprietar">Initial value of the numeProprietar property.</param> public static Contact CreateContact(global::System.Int32 idContact, global::System.String telefon, global::System.String email, global::System.String numeProprietar) { Contact contact = new Contact(); contact.idContact = idContact; contact.telefon = telefon; contact.email = email; contact.numeProprietar = numeProprietar; return contact; }
/// <summary> /// Metoda care insereaza un nou contact. /// </summary> /// <param name="numeProprietar">nume proprietarului</param> /// <param name="email">emailul</param> /// <param name="telefon">telefonul</param> /// <returns>id-ul contactului nou inserat</returns> public static int InsertContact(string numeProprietar,string email,string telefon) { try { using (MasterEntities context = new MasterEntities()) { var c = new Contact() { numeProprietar = numeProprietar, email = email, telefon = telefon }; context.Contact.AddObject(c); context.SaveChanges(); return c.idContact; } } catch (Exception ex) { return -1; } }
/// <summary> /// Deprecated Method for adding a new object to the Contact EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContact(Contact contact) { base.AddObject("Contact", contact); }