/// <summary> /// Create a new zivotinja object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="ime">Initial value of the ime property.</param> /// <param name="vrsta">Initial value of the vrsta property.</param> /// <param name="zooId">Initial value of the zooId property.</param> public static zivotinja Createzivotinja(global::System.Int32 id, global::System.String ime, global::System.String vrsta, global::System.Int32 zooId) { zivotinja zivotinja = new zivotinja(); zivotinja.id = id; zivotinja.ime = ime; zivotinja.vrsta = vrsta; zivotinja.zooId = zooId; return(zivotinja); }
DatabaseEntities db; //neka bude global za klasu #endregion Fields #region Methods protected void Button1_Click(object sender, EventArgs e) { //kreiraj novi objekt životinja zivotinja z = new zivotinja(); //POstavo property iz TB-a z.ime = tb_ime.Text; z.vrsta = tb_vrsta.Text; //uzmi iz DDL vrijednost ZOO-a z.zooId = Int32.Parse(ddl_zoo.SelectedValue); //dodaj u memoriji servera novi objekt u životinje db.AddObject("zivotinja", z); //preko ADO.NET-a spremi u Bazu db.SaveChanges(); postavi_grid(); }
/// <summary> /// Deprecated Method for adding a new object to the zivotinja EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTozivotinja(zivotinja zivotinja) { base.AddObject("zivotinja", zivotinja); }
/// <summary> /// Create a new zivotinja object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="ime">Initial value of the ime property.</param> /// <param name="vrsta">Initial value of the vrsta property.</param> /// <param name="zooId">Initial value of the zooId property.</param> public static zivotinja Createzivotinja(global::System.Int32 id, global::System.String ime, global::System.String vrsta, global::System.Int32 zooId) { zivotinja zivotinja = new zivotinja(); zivotinja.id = id; zivotinja.ime = ime; zivotinja.vrsta = vrsta; zivotinja.zooId = zooId; return zivotinja; }