// GET: GuideDetails public ActionResult GuideDetails(int id) { ViewBag.Guide_id = id; //var user = iuserbll.GetAll(); var guide = iguidebll.GetAll(); var comment = icommentbll.GetAll(); var reply = ireplybll.GetAll(); var guidedetails = iguidedetailsbll.GetAll(); var guidedetails1 = iguidebll.GetById(id); GuideDetailsViewModel guidedetailsvm = new GuideDetailsViewModel(); //guidedetailsvm.user = user; guidedetailsvm.guide = guide; guidedetailsvm.comment = comment; guidedetailsvm.reply = reply; guidedetailsvm.guidedetails = guidedetails; guidedetailsvm.guidedetails1 = guidedetails1; return(View(guidedetailsvm)); }
public IActionResult Details(int id) { var guide = this.guides .Details(id); if (guide.Content == null) { return(NotFound()); } var result = new GuideDetailsViewModel { Id = guide.Id, Title = guide.Title, Content = guide.Content }; return(View(result)); }
public IActionResult Details(int id) { var guide = _guidesService.ById(id); if (guide == null) { return(Redirect(Guides_Root_Path)); } var model = new GuideDetailsViewModel { Id = guide.Id, Title = guide.Title, UserName = guide.Creator.UserName, UserAvatar = guide.Creator.AvatarUrl }; FormatContent(guide, model); return(View(model)); }
// GET: GuideDetails public ActionResult GuideDetails(int id) { Session["Guide_id"] = id; //var user = iuserbll.GetAll(); var guide = iguidebll.GetAll(); var comment = icommentbll.GetAll(); var reply = ireplybll.GetAll(); var guidedetails = iguidedetailsbll.GetAll(); var guidedetails1 = iguidebll.GetById(id); var viewcomment = icommentbll.GetCommentsByGuideId(id); GuideDetailsViewModel guidedetailsvm = new GuideDetailsViewModel { //guidedetailsvm.user = user; guide = guide, comment = comment, reply = reply, guidedetails = guidedetails, guidedetails1 = guidedetails1, viewcomment = viewcomment }; return(View(guidedetailsvm)); }
private static void FormatContent(Guide guide, GuideDetailsViewModel model) { model.Content = string.Join( "<br/>", guide.Content.Split(new[] { Environment.NewLine }, StringSplitOptions.None) .Select(x => HttpUtility.HtmlEncode(x))); }