public ActionResult Article(Guid id) { ArticleModel article = _articleDBOpps.GetArticles("Id", id.ToString()).First(); if (article == null) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } ArticleViewModel model = new ArticleViewModel { Id = article.Id, Title = article.Title, LeadParagraph = article.LeadingParagraph, Content = article.Body, AdditionDate = article.AdditionDate, Image = article.Image }; if (!User.Identity.IsAuthenticated || ((ClaimsIdentity)User.Identity).Claims .Where(c => c.Type == ClaimTypes.Role) .Select(c => c.Value).FirstOrDefault() == "Regular") { model.Content = article.Body.Substring(0, 400) + "..."; ViewBag.Message = "( ͡° ͜ʖ ͡° )つ──☆*:・゚Aby zobaczyć pełną wersję artykułu wykup subskrybcję."; } else { model.Content = article.Body; ViewBag.Message = ""; } return(View(model)); }
public ActionResult EditArticle(string id) { ArticleModel article = _articleDBOpps.GetArticles("Id", id).First(); ModifyArticleViewModel model = new ModifyArticleViewModel { Id = article.Id, Title = article.Title, LeadParagraph = article.LeadingParagraph, Content = article.Body }; return(View(model)); }