//[OutputCache(Duration = 60, VaryByParam = "none", VaryByCustom = "userName")] public ActionResult Details(string lawname, int lawid) { var law = _lawRep.SingleLaw(lawid).Or404(); var val = new LawDetailsViewModel() { Law = law, Breadcrumb = new List<Breadcrumb>() { Breadcrumb.Home, Breadcrumb.LawIndex, law.Breadcrumb(), }, MetaDescription = law.ShortName + " på Folkets Ting" }; var tagvm = new TagControlViewModel(_tagRep, lawid, ContentType.Law) { ElementName = lawname, }; val.TagVM = tagvm; if(this.User() != null) val.TagVM.UserTags = _tagRep.UserTags(lawid, this.User().UserId, ContentType.Law); var finalvote = law.LawVotes.Where(_ => _.IsFinal == true).FirstOrDefault(); if (finalvote != null) { val.PieChartData = new PieChartViewModel() { PartyVotes = ViewConstants.GetPartyVotes(finalvote.LawVoteId).ToList(), LawVoteId = finalvote.LawVoteId }; val.FinalVoteDate = finalvote.Date.Value; val.Vote = finalvote; } if (_lawRep.IsInStage(LawStage.First, lawid)) { val.FirstNegot = _lawRep.SingleDeliberation(lawid, LawStage.First); val.FirstCommCount = _lawRep.DeliberationCommentCount(val.FirstNegot.DeliberationId); } if (_lawRep.IsInStage(LawStage.Second, lawid)) { val.SecondNegot = _lawRep.SingleDeliberation(lawid, LawStage.Second); val.SecondCommCount = _lawRep.DeliberationCommentCount(val.SecondNegot.DeliberationId); } if (_lawRep.IsInStage(LawStage.Third, lawid)) { val.ThirdNegot = _lawRep.SingleDeliberation(lawid, LawStage.Third); val.ThirdCommCount = _lawRep.DeliberationCommentCount(val.ThirdNegot.DeliberationId); } val.IsProposed = _lawRep.IsProposed(lawid); val.IsPassed = _lawRep.IsPassed(lawid); val.IsAfterSecond = _lawRep.IsAfterSecond(lawid); if (val.IsProposed) val.ProposedCommCount = _lawRep.CommentCount(LawStage.First, lawid); if (val.IsAfterSecond) val.AfterSecCommCount = _lawRep.CommentCount(LawStage.Second, lawid); if (val.IsPassed) val.PassedCommCount = _lawRep.CommentCount(LawStage.Third, lawid); val.MetaDescription = law.Summary; val.CountLink = law.CountLink(this); val.Views = _hitRep.ViewCount(lawid, ContentType.Law); val.LatestActivity = _lawRep.LatestActivity(lawid); return View("Details", val); }
public ActionResult Details(string questiontext, int qid) { P20Question q = _p20Rep.GetQuestion(qid).Or404(); TagControlViewModel tagvm = new TagControlViewModel(_tagRep, qid, ContentType.P20Question) { ElementName = questiontext, }; if (this.User() != null) tagvm.UserTags = _tagRep.UserTags(qid, this.User().UserId, ContentType.P20Question); return View("Details", new P20QuestionDetailViewModel() { Question = q, QuestionCommentCount = _p20Rep.QuestionCommentCount(qid), BackgroundCommentCount = _p20Rep.BackgroundCommentCount(qid), CountLink = q.CountLink(this), LatestActivity = _p20Rep.LatestActivity(qid), TagVM = tagvm, Breadcrumb = new List<Breadcrumb>() { Breadcrumb.Home, Breadcrumb.P20Index, new Breadcrumb( q.Question.Truncate(100, true), "P20Question", "Details", new{lawname = questiontext, lawid = qid}), }, MetaDescription = q.Question.Truncate(100, true) + " på Folkets Ting", } ); }