public ActionResult CreateLawExpertComment(int lawId) { LawService service = new LawService(); var model = service.InitializeCreateExpertCommentModel(lawId); return(View(model)); }
public ActionResult LawDetails(int lawId) { LawService service = new LawService(); LawEditModel model = service.GetLawEditModel(lawId); return(View(model)); }
public ActionResult DeleteLawCustomVote(int customVoteId) { LawService service = new LawService(); var isDeleted = service.DeleteCustomVote(customVoteId); return(Json(new { isDeleted = isDeleted, customVoteId = customVoteId }, JsonRequestBehavior.AllowGet));; }
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)); }
public ActionResult EditLawSection(int lawSectionId) { LawService service = new LawService(); var model = service.GetLawSectionEditModel(lawSectionId); return(View(model)); }
public ActionResult DeleteLawSectionCustomVote(int lawSectionCustomVoteID) { LawService service = new LawService(); var isDeleted = service.DeleteLawSectionCustomVote(lawSectionCustomVoteID); return(Json(new { isDeleted = isDeleted, lawSectionCustomVoteID = lawSectionCustomVoteID }, JsonRequestBehavior.AllowGet)); }
public ActionResult EditLawSectionCustomVote(int lawSectionCustomVoteID) { LawService service = new LawService(); var model = service.GetLawSectionCustomVoteEditModel(lawSectionCustomVoteID); return(View(model)); }
public ActionResult DeleteLawSection(int lawSectionId) { LawService service = new LawService(); var isDeleted = service.DeleteLawSection(lawSectionId); return(Json(new { isDeleted = isDeleted, lawSectionId = lawSectionId }, JsonRequestBehavior.AllowGet)); }
public ActionResult ManageLawQuestions(int lawId) { LawService service = new LawService(); var model = service.GetLawEditModel(lawId); return(View(model)); }
public ActionResult CreateLaw() { LawService service = new LawService(); var model = service.InitializeLawEditModel(SessionManager.Current.CurrentParliamentId); return(View(model)); }
public ActionResult CreateSuggestedRepresentative(int lawId) { LawService service = new LawService(); var model = service.InitializeCreateLawRepresentativeModel(lawId); return(View(model)); }
public ActionResult GetSectionVoteOptions(int lawId, int sectionId) { LawService service = new LawService(); LawSectionCustomVoteListModel model = service.getLawSectionCustomVotesList(lawId, sectionId); return(PartialView("_SectionVoteOptions", model)); }
public void VoteLawsection_NewCustomVote_Voted() { var user = Helpers.CreateNewUser(); var law = Helpers.GetTestLaw(); try { var lawModelOld = new LawService().GetLawModel(law.LawID, user.Id, CommentOrder.Chronological); var lawSectionModelOld = lawModelOld.Sections.First(); //new LawService().VoteLawSection( lawSectionModelOld.LawSection.LawSectionID, user.Id, -1, null ); var lawModelNew = new LawService().GetLawModel(law.LawID, user.Id, CommentOrder.Chronological); var lawSectionModelNew = lawModelNew.Sections.Where(x => x.LawSection.LawSectionID == lawSectionModelOld.LawSection.LawSectionID).First(); Assert.AreEqual(lawSectionModelOld.VotesDown, lawSectionModelNew.VotesDown, "There Should be no changes in the vote"); Assert.AreEqual(lawSectionModelOld.VotesUp, lawSectionModelNew.VotesDown, "There Should be no changes in the vote"); Assert.AreEqual(true, lawSectionModelNew.UserVoted, "User did vote"); Assert.AreEqual(false, lawSectionModelOld.UserVoted, "User did not have previous vote"); } finally { Helpers.DeleteUser(user); } }
public ActionResult GetLawVoteOptions(int lawId) { LawService service = new LawService(); LawCustomVoteListModel model = service.GetLawCustomVotesList(lawId); return(PartialView("_LawVoteOptions", model)); }
public ActionResult ManageLawSuggestedRepresentatives(int lawId) { LawService service = new LawService(); var model = service.GetLawEditModel(lawId); return(View(model)); }
public void VoteLawSection_ExistingCustomVote_Voted() { var user = Helpers.CreateNewUser(); var law = Helpers.GetTestLaw(); try { var lawModelOld = new LawService().GetLawModel(law.LawID, user.Id, CommentOrder.Chronological); var lawSectionModelOld = lawModelOld.Sections.First(); var customVotes = new LawService().getLawSectionCustomVotesList(lawSectionModelOld.LawSection.LawID, lawSectionModelOld.LawSection.LawSectionID); var customVote = customVotes.LawSectionCustomVotes.Where(x => x.LawSectionCustomVoteID > 0).First(); //new LawService().VoteLawSection( law.LawID, user.Id, customVote.LawSectionCustomVoteID, null ); var lawModelNew = new LawService().GetLawModel(law.LawID, user.Id, CommentOrder.Chronological); var lawSectionModelNew = lawModelNew.Sections.Where(x => x.LawSection.LawSectionID == lawSectionModelOld.LawSection.LawSectionID).First(); int votesUpModifier = customVote.Vote.Value ? 1 : 0; int votesDownModifier = customVote.Vote.Value ? 0 : 1; Assert.AreEqual(lawSectionModelOld.VotesDown + votesDownModifier, lawSectionModelNew.VotesDown, "Vote Down not counted"); Assert.AreEqual(lawSectionModelOld.VotesUp + votesUpModifier, lawSectionModelNew.VotesUp, "Vote Down not counted"); Assert.AreEqual(true, lawSectionModelNew.UserVoted, "User did vote"); Assert.AreEqual(false, lawSectionModelOld.UserVoted, "User did not have previous vote"); } finally { Helpers.DeleteUser(user); } }
public ActionResult DeleteLawSuggestedRepresentative(int lawRepresentativeAssociationID) { LawService service = new LawService(); var isDeleted = service.DeleteLawRepresentative(lawRepresentativeAssociationID); return(Json(new { isDeleted = isDeleted, lawRepresentativeAssociationID = lawRepresentativeAssociationID }, JsonRequestBehavior.AllowGet));; }
public ActionResult IndexUnverifiedDirectQuestions() { LawService lawService = new LawService(); var model = lawService.GetUnverifiedRepresentativeQuestions(); return(PartialView("_IndexUnverifiedDirectQuestions", model)); }
public ActionResult Search() { LawService service = new LawService(); LawSearchModel model = service.InitializeSearchModel(); return(View(model)); }
public ActionResult IndexUnverifiedSectionAnswers() { LawService lawService = new LawService(); var model = lawService.GetUnverifiedLawSectionCustomVotes(); return(PartialView("_IndexUnverifiedSectionAnswers", model)); }
public ActionResult CreateLawSection(int lawId) { LawService service = new LawService(); var model = service.InitializeLawSectionEditModel(lawId); return(View(model)); }
public ActionResult DeleteLawQuestion(int questionId) { LawService service = new LawService(); var isDeleted = service.DeletePredefinedQuestionEditModel(questionId); return(Json(new { isDeleted = isDeleted, questionId = questionId }, JsonRequestBehavior.AllowGet));; }
public ActionResult EditLawQuestion(int questionId) { LawService service = new LawService(); var model = service.GetPredefinedQuestionEditModel(questionId); return(View(model)); }
public ActionResult DeleteLaw(int lawId, string test) { LawService service = new LawService(); service.DeleteLaw(lawId); return(RedirectToAction("ManageLaws")); }
public ActionResult EditLawCustomVote(int customVoteId) { LawService service = new LawService(); var model = service.GetCustomVoteEditModel(customVoteId); return(View(model)); }
public ActionResult CreateSuggestedRepresentative(CreateLawRepresentativeModel model) { TryUpdateModel(model); LawService service = new LawService(); service.AddLawRepresentative(model); return(RedirectToAction("ManageLawSuggestedRepresentatives", new { lawId = model.LawID })); }
public ActionResult CreateLawCustomVote(CustomVoteEditModel model) { TryUpdateModel(model); LawService service = new LawService(); service.CreateCustomVote(model); return(RedirectToAction("ManageLawCustomVotes", new { lawId = model.LawID })); }
public ActionResult CreateLawCustomVote(int lawId) { LawService service = new LawService(); var model = service.InitializeCustomVoteEditModel(lawId); model.IsSuggested = true; return(View(model)); }
public ActionResult CreateLawExpertComment(CreateExpertcommentModel model) { TryUpdateModel(model); LawService service = new LawService(); service.CreateExpertComment(model); return(RedirectToAction("ManageLawExpertComments", new { lawId = model.LawID })); }
public ActionResult PointOutLawSectionRemove(int lawSectionId) { LawService service = new LawService(); service.PointOutSection(lawSectionId, null); return(Json(new { isSuccess = true }, JsonRequestBehavior.AllowGet)); }