/// <summary> /// Deprecated Method for adding a new object to the Recenzie EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRecenzie(Recenzie recenzie) { base.AddObject("Recenzie", recenzie); }
/// <summary> /// Metoda care salveaza commentul facut de utilizator in baza de date si repopuleaza zona de comentarii din pagina, adaugand si acest ultim comentariu. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void submit_Click(object sender, EventArgs e) { commentUser.Text = comment.Text; int idUnitate; //salvez in baza de date commentul using (MasterEntities context = new MasterEntities()) { string userComment = comment.Text; string nume = GetUsername(); commentUser.Text = nume; int idUtilizator = client.GetIdUtilizator(nume); var unitate = context.Unitati.First(x => x.numeUnitate == numeUnitate); idUnitate = unitate.idUnitate; DAL.Recenzie recenzie = new DAL.Recenzie(); recenzie.idUnitate = idUnitate; recenzie.idUtilizator = idUtilizator; recenzie.comentariu = userComment; recenzie.rank = rankLocal; context.AddToRecenzie(recenzie); context.SaveChanges(); } comment.Text = string.Empty; //rank.SelectedIndex = 0; divComment.Controls.Clear(); ShowComments(idUnitate); }
/// <summary> /// Create a new Recenzie object. /// </summary> /// <param name="idUnitate">Initial value of the idUnitate property.</param> /// <param name="idUtilizator">Initial value of the idUtilizator property.</param> /// <param name="comentariu">Initial value of the comentariu property.</param> /// <param name="rank">Initial value of the rank property.</param> /// <param name="idRecenzie">Initial value of the idRecenzie property.</param> public static Recenzie CreateRecenzie(global::System.Int32 idUnitate, global::System.Int32 idUtilizator, global::System.String comentariu, global::System.Int32 rank, global::System.Int32 idRecenzie) { Recenzie recenzie = new Recenzie(); recenzie.idUnitate = idUnitate; recenzie.idUtilizator = idUtilizator; recenzie.comentariu = comentariu; recenzie.rank = rank; recenzie.idRecenzie = idRecenzie; return recenzie; }