protected void articleRating_Changed(object sender, AjaxControlToolkit.RatingEventArgs e) { if (User.Identity.Name == "") { warning.Text = "Članak mogu ocijeniti samo prijavljeni korisnici."; warning_block.Visible = true; } else { ClanciOcjene grade = new ClanciOcjene(); grade.ClanakID = articleId; grade.KorisnikID = Convert.ToInt32(User.Identity.Name); grade.Ocjena = articleRating.CurrentRating; grade.DatumKreiranja = DateTime.Now; grade.DatumIzmjene = DateTime.Now; DAClanci.GradeArticle(grade); articleRating.ReadOnly = true; ratingLabel.Text = "Vaša ocjena: " + grade.Ocjena.ToString(); dateRatedLabel.Text = string.Format("{0:dd.MM.yyyy}", grade.DatumKreiranja); rating_block.Visible = true; BindGrade(); } }
public static void GradeArticle(ClanciOcjene grade) { Connection.dm.ClanciOcjene.Add(grade); Connection.dm.SaveChanges(); }