Exemplo n.º 1
0
        public ActionResult LawDetails(int?lawId, string pCode, string scrollPosition, string sp)
        {
            if (lawId == null)
            {
                return(HttpNotFound());
            }

            LawService service = new LawService();
            LawModel   model   = service.GetLawModel(lawId.Value, User.Identity.GetUserId(), Infrastructure.CommentOrder.Chronological);

            if (model == null)
            {
                return(HttpNotFound());
            }

            new ParliamentService().GetTenantData(model.Law.ParliamentID, out string parliamentCode);
            if (pCode == null || pCode != parliamentCode)
            {
                return(RedirectToRoute(JavnaRasprava.Resources.Routes.JavnaRasprava_LawDetails, new { pCode = parliamentCode, lawId }));
            }

            QuestionsService questionsService = new QuestionsService();

            model.RepresentativeAnswers = questionsService.GetLatestAnswersForLaw(lawId.Value, User.Identity.GetUserId());

            ViewBag.scrollPosition = sp ?? scrollPosition;

            model.FbCommentsPath = string.Format(ConfigurationManager.AppSettings["Facebook.LawUrlTemplate"], lawId);

            return(View("Law", model));
        }
Exemplo n.º 2
0
        public ActionResult VoteForSection(int lawId, int sectionId, int answerId, string customAnswerText)
        {
            LawService service = new LawService();

            service.VoteLawSection(sectionId, User.Identity.GetUserId(), Request.UserHostAddress, answerId, customAnswerText);               //TODO

            LawModel model = service.GetLawModel(lawId, User.Identity.GetUserId(), Infrastructure.CommentOrder.Chronological);

            return(PartialView("_SectionVotingDetails", model.Sections.Where(s => s.LawSection.LawSectionID == sectionId).First()));
        }
Exemplo n.º 3
0
        public ActionResult VoteForLaw(int lawId, int answerId, string customAnswerText)
        {
            LawService service = new LawService();

            service.VoteLaw(lawId, User.Identity.GetUserId(), Request.UserHostAddress, answerId, customAnswerText);

            LawModel model = service.GetLawModel(lawId, User.Identity.GetUserId(), Infrastructure.CommentOrder.Chronological);

            return(PartialView("_LawVotingDetails", model));

            ;
        }