public static MvcHtmlString ViewComment(this HtmlHelper html, comment comment) { UrlHelper url = new UrlHelper(html.ViewContext.RequestContext, html.RouteCollection); string result = ""; string quote = comment.QuoteId; if (!string.IsNullOrEmpty(quote)) { OKDbEntities Db = new OKDbEntities(); int id = Convert.ToInt32(quote.Split('-')[1]); if (quote.Split('-')[0] == "t") { var quotetopic = Db.topic.Find(id); result = "<div style=\"max-height: 300px; overflow-x: hidden; overflow-y: scroll;\"><blockquote><b>" + OK.UserName(quotetopic.user) + "</b>, <small>" + html.ShortDateTime((DateTime)quotetopic.CreationDate) + "</small><small style=\"float: right;\"><a href=\"" + url.Action("GoTopic", new { id = quotetopic.Id }) + "\">Konuya Git</a></small><div class=\"comment\">" + html.ViewTopic(quotetopic.Content) + "</blockquote></div>"; } else { var quotecomment = Db.comment.Find(id); result = "<div style=\"max-height: 300px; overflow-x: hidden; overflow-y: scroll;\"><blockquote><b>" + OK.UserName(quotecomment.user) + "</b>, <small>" + html.ShortDateTime((DateTime)quotecomment.CreationDate) + "</small><small style=\"float: right;\"><a href=\"" + url.Action("GoComment", new { id = quotecomment.Id }) + "\">Cevaba Git</a></small><div class=\"comment\">" + html.ViewComment(quotecomment) + "</blockquote></div>"; } } result += comment.Content; return(MvcHtmlString.Create(result.ToString())); }
public static MvcHtmlString UserInfo(this HtmlHelper html, int id) { OKDbEntities Db = new OKDbEntities(); string result = ""; UrlHelper url = new UrlHelper(html.ViewContext.RequestContext, html.RouteCollection); var user = Db.user.Single(x => x.Id == id); result = "<div class=\"image\" onclick=\"$.OK.Modal('" + url.Action("UserInfo", "Account", new { id = id }) + "');\"><img src=\"" + user.ImageFile + "\" /></div>" + "<div class=\"name\" onclick=\"$.OK.Modal('" + url.Action("UserInfo", "Account", new { id = id }) + "');\">" + OK.UserName(user) + "<img src=\"" + url.Content("~/Themes/" + OK.Config("site-theme") + "/Images/" + OK.UserState(user.Id, (DateTime)user.LastLoginDate) + ".png") + "\" /></div>" + "<div class=\"level\">" + user.type.Name + "</div>" + "<div class=\"rating\">" + html.UserRating((int)user.Rating) + "</div>"; return(MvcHtmlString.Create("<div class=\"user-info\">" + result + "</div>")); }