/// <summary> /// Deprecated Method for adding a new object to the Camere EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCamere(Camere camere) { base.AddObject("Camere", camere); }
/// <summary> /// Create a new Camere object. /// </summary> /// <param name="idCamera">Initial value of the idCamera property.</param> /// <param name="nrPaturi">Initial value of the nrPaturi property.</param> /// <param name="idUnitate">Initial value of the idUnitate property.</param> /// <param name="pret">Initial value of the pret property.</param> /// <param name="baie">Initial value of the baie property.</param> public static Camere CreateCamere(global::System.Int32 idCamera, global::System.Int32 nrPaturi, global::System.Int32 idUnitate, global::System.Decimal pret, global::System.Boolean baie) { Camere camere = new Camere(); camere.idCamera = idCamera; camere.nrPaturi = nrPaturi; camere.idUnitate = idUnitate; camere.pret = pret; camere.baie = baie; return camere; }
public static void InsertCamera(int nrPaturi, int pretC, Boolean baie, string numeUnitate) { try { using (MasterEntities context = new MasterEntities()) { var obj = context.Unitati.First(x => x.numeUnitate == numeUnitate); var r = new Camere() { nrPaturi = nrPaturi, pret = Decimal.Parse(pretC.ToString()), baie = baie, idUnitate = obj.idUnitate }; context.Camere.AddObject(r); context.SaveChanges(); } } catch (Exception ex) { } }