Пример #1
0
        /// <summary>
        /// obtains the question detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id)
        {
            ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository    objcontent    = new ContentRepository(SessionCustom);
            QuestionRepository   objquestion   = new QuestionRepository(SessionCustom);
            FileattachRepository objfiles      = new FileattachRepository(SessionCustom);
            TagRepository        objtag        = new TagRepository(SessionCustom);
            SectionRepository    objsection    = new SectionRepository(SessionCustom);
            TemplateRepository   objtemplate   = new TemplateRepository(SessionCustom);
            AnswerRepository     objanswer     = new AnswerRepository(SessionCustom);
            TagFacade            tagFacade     = new TagFacade();

            objtemplate.Entity.Type = 0;

            objquestion.Entity.ContentId           =
                objfiles.Entity.ContentId          =
                    objcontent.Entity.ContentId    =
                        objanswer.Entity.ContentId = id;

            objquestion.LoadByKey();
            objcontent.LoadByKey();

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Index",
                       new QuestionModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                Question = objquestion.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListAnswers = objanswer.GetAllReadOnly(),
                Categories = objcontent.Categories(),
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }