public ReviewItem(Review rev) { int userid = rev.UserUserId; eBookStoreDBModelContainer _ebs = new eBookStoreDBModelContainer(); string username = _ebs.Users.SingleOrDefault(u => u.UserId == userid).UserName; string date = rev.ReviewDate.ToShortDateString(); string text = rev.ReviewText; Htmlify ptex = new Htmlify(); text = ptex.Revert(text); desc = "<p class=\"revname\">" + username + "</p> <p class=\"revdate\">" + date + "</p><p class=\"revtext\">" + text + "</p>"; }
protected void btnAddrev_Click(object sender, EventArgs e) { int TitleId = Int32.Parse(Request.QueryString["TitleId"]); imgCover.ImageUrl = "../../Storage/Images/" + TitleId.ToString() + ".png"; Title ttl = ebs.Titles.SingleOrDefault(t => t.TitleId == TitleId); Review rev = new Review(); Htmlify htex = new Htmlify(); rev.ReviewText = htex.Convert(txtRev.Text); rev.ReviewDate = DateTime.Now; rev.UserUserId = Int32.Parse(Session["eStoreUserId"].ToString()); rev.TitleTitleId = TitleId; ebs.Reviews.Add(rev); ebs.SaveChanges(); FillPage(); }