コード例 #1
0
        public ActionResult ReportDetails(int id, string group)
        {
            if (group == "newsComment")
            {
                var vm = new ListReportedNewsCommentViewModel
                {
                    ReportedComments = _newsCommentRepository.GetReportedCommentDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedComments.Select(rc => new ReportedGeneral
                {
                    ReportedBy = rc.ReportedBy.Username,
                    ReportedDate = rc.ReportedDate,
                    Reason = rc.Reason
                }).ToList();

                return View(reports);
            }

            if (group == "tipComment")
            {
                var vm = new ListReportedTipCommentViewModel
                {
                    ReportedComments = _tipCommentRepository.GetReportedCommentDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedComments.Select(rc => new ReportedGeneral
                {
                    ReportedBy = rc.ReportedBy.Username,
                    ReportedDate = rc.ReportedDate,
                    Reason = rc.Reason
                }).ToList();

                return View(reports);
            }

            if (group == "recipeComment")
            {
                var vm = new ListReportedRecipeCommentViewModel
                {
                    ReportedComments = _recipeCommentRepository.GetReportedCommentDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedComments.Select(rc => new ReportedGeneral
                {
                    ReportedBy = rc.ReportedBy.Username,
                    ReportedDate = rc.ReportedDate,
                    Reason = rc.Reason
                }).ToList();

                return View(reports);
            }

            if (group == "question")
            {
                var vm = new ListReportedQuestionViewModel
                {
                    ReportedQuestions = _questionRepository.GetReportedQuestionDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedQuestions.Select(rp => new ReportedGeneral
                {
                    ReportedBy = rp.ReportedBy.Username,
                    ReportedDate = rp.ReportedDate,
                    Reason = rp.Reason
                }).ToList();
                return View(reports);
            }

            if (group == "answer")
            {
                var vm = new ListReportedAnswerViewModel
                {
                    ReportedAnswers = _answerRepository.GetReportedAnswerDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedAnswers.Select(rp => new ReportedGeneral
                {
                    ReportedBy = rp.ReportedBy.Username,
                    ReportedDate = rp.ReportedDate,
                    Reason = rp.Reason
                }).ToList();
                return View(reports);
            }

            if (group == "news")
            {
                var vm = new ListReportedNewsViewModel
                {
                    ReportedNews = _newsRepository.GetReportedNewsDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedNews.Select(rp => new ReportedGeneral
                {
                    ReportedBy = rp.ReportedBy.Username,
                    ReportedDate = rp.ReportedDate,
                    Reason = rp.Reason
                }).ToList();
                return View(reports);
            }

            if (group == "tip")
            {
                var vm = new ListReportedTipViewModel
                {
                    ReportedTips = _tipRepository.GetReportedTipDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedTips.Select(rp => new ReportedGeneral
                {
                    ReportedBy = rp.ReportedBy.Username,
                    ReportedDate = rp.ReportedDate,
                    Reason = rp.Reason
                }).ToList();
                return View(reports);
            }

            if (group == "recipe")
            {
                var vm = new ListReportedRecipeViewModel
                {
                    ReportedRecipes = _recipeRepository.GetReportedRecipeDetails(id).Data
                };
                IList<ReportedGeneral> reports = vm.ReportedRecipes.Select(rp => new ReportedGeneral
                {
                    ReportedBy = rp.ReportedBy.Username,
                    ReportedDate = rp.ReportedDate,
                    Reason = rp.Reason
                }).ToList();
                return View(reports);
            }

            return null;
        }
コード例 #2
0
        public ViewResult ManageReportedAnswer(int? minReportNumber)
        {
            if (minReportNumber == null || minReportNumber < 1)
                minReportNumber = AppConfigs.MinReportNumber;
            var vm = new ListReportedAnswerViewModel
            {
                Answers = _answerRepository.GetAllReportedAnswers(minReportNumber.Value).Data,
                MinReportNumber = minReportNumber.Value
            };

            return View(vm);
        }