예제 #1
0
        public ActionResult EditParliament(Models.Parliament.ParliamentEditModel model)
        {
            var service = new ParliamentService();

            service.UpdateParliament(model.ParliamentID.Value, model);
            return(RedirectToAction("ParliamentDetails", new { id = model.ParliamentID }));
        }
예제 #2
0
        public ActionResult CreateParliamentHouse(int id)
        {
            var service = new ParliamentService();
            var model   = service.InitializeEditParliamentHouseModel(id);

            return(View("Parliament/CreateParliamentHouse", model));
        }
예제 #3
0
        public ActionResult EditParliamentHouse(int ParliamentId, int HouseId)
        {
            var service = new ParliamentService();
            var model   = service.InitializeEditParliamentHouseModel(ParliamentId, HouseId);

            return(View("Parliament/EditParliamentHouse", model));
        }
예제 #4
0
        public ActionResult CreateParliament(Models.Parliament.ParliamentEditModel model)
        {
            var service = new ParliamentService();

            service.CreateParliament(model);
            return(RedirectToAction("ManageParliament"));
        }
예제 #5
0
        public ActionResult EditParliamentHouses(int id)
        {
            var service = new ParliamentService();
            var model   = service.GetParliamentEditModel(id);

            return(View("Parliament/EditParliamentHouses", model));
        }
예제 #6
0
        public ActionResult CreateParliament()
        {
            var service = new ParliamentService();
            var model   = service.InitializeParliamentEditModel(SessionManager.Current.CurrentParliamentId);

            return(View("Parliament/Create", model));
        }
예제 #7
0
        public ActionResult DeleteParliament(int id, string test)
        {
            var service = new ParliamentService();

            service.DeleteParliament(id);
            return(RedirectToAction("ManageParliament"));
        }
예제 #8
0
        public ActionResult DeleteParliament(int id)
        {
            var service = new ParliamentService();
            var model   = service.GetParliamentEditModel(id);

            return(View("Parliament/Delete", model));
        }
예제 #9
0
        public ActionResult DeleteParliamentHouse(int id)
        {
            var service      = new ParliamentService();
            var ParliamentId = service.DeleteParliamentHouse(id);

            return(RedirectToAction("EditParliamentHouses", new { id = ParliamentId }));
        }
예제 #10
0
        public ActionResult EditParliamentHouse(Models.Parliament.ParliamentHouseEditModel model)
        {
            var service = new ParliamentService();

            service.UpdateParliamentHouse(model.ParliamentHouseID, model);
            return(RedirectToAction("EditParliamentHouses", new { id = model.ParliamentID }));
        }
예제 #11
0
        public ActionResult ManageParliament()
        {
            var service = new ParliamentService();
            var model   = service.GetAllParliamentEditModels();

            return(View("Parliament/Index", model));
        }
예제 #12
0
        // GET: Parliament
        public ActionResult Index()
        {
            ParliamentService   service = new ParliamentService();
            ParliamentListModel model   = service.GetParliaments();

            return(View(model));
        }
예제 #13
0
        public ActionResult Index(string pCode)
        {
            var parliamentId = new ParliamentService().GetParliamentId(pCode);

            var service = new QuizService();
            var model   = service.InitializeSearchModel(parliamentId);

            return(View(model));
        }
예제 #14
0
        public ActionResult Index(string pCode)
        {
            var parliamentId = new ParliamentService().GetParliamentId(pCode);

            RepresentativeService   service = new RepresentativeService();
            RepresentativeListModel model   = service.GetAllRepresentativesForParliament(parliamentId);

            return(View(model));
        }
예제 #15
0
        // GET: Petitions
        public ActionResult Index()
        {
            var service             = new PetitionService();
            var parliamentService   = new ParliamentService();
            PetitionHomeModel model = new PetitionHomeModel
            {
                LastSuccessfulPetitions = service.GatLatestPetitions(AppConfig.GetInt("Petitions.Index.LastSuccessfulPetitions", 5)),
                TopActivePetitions      = service.GetTopActivePetitions(AppConfig.GetInt("Petitions.Index.TopActivePetitions", 5)),
                Parliaments             = parliamentService.GetParliaments()
            };

            return(View(model));
        }
예제 #16
0
        private ActionResult GetPartialView(string pCode, string returnUrl, string partialViewName, bool returnAll = false)
        {
            var parliament = GetCurrentParliament(pCode);

            var parliaments = new ParliamentService().GetAllParliamentsCached().Where(x => x.Tenant == parliament.Tenant).ToList();


            if (!returnAll && parliaments.Count() == 1)
            {
                return(new EmptyResult());
            }

            string baseTenantAddress = AppConfig.GetStringValue("BaseTenantAddress");

            ViewBag.BaseTenantAddress = baseTenantAddress;
            ViewBag.ReturnUrl         = returnUrl;

            var parliamentsToPass = returnAll ? new ParliamentService().GetAllParliamentsCached() : parliaments;

            if (parliamentsToPass.Count() == 1)
            {
                return(new EmptyResult());
            }

            int colNumber = 1;

            switch (parliamentsToPass.Count)
            {
            case 2:
            case 3:
            case 4:
            case 6:
                colNumber = (12 / parliamentsToPass.Count);
                break;

            case 5:
                colNumber = 2;
                break;
            }
            ViewBag.DivClass = $"col-sm-{colNumber}";

            return(PartialView(partialViewName, parliamentsToPass));
        }
        public ActionResult Index(string pCode)
        {
            var parliamentId = new ParliamentService().GetParliamentId(pCode);

            var service     = new LawService();
            var searchModel = service.InitializeSearchModel();

            searchModel.Order         = "desc";
            searchModel.SortBy        = "createTime";
            searchModel.ParliamentId  = parliamentId;
            searchModel.PageItemCount = 16;
            var results = service.SearchLaw(searchModel);

            var model = new AllLawsModel
            {
                SearchModel = searchModel,
                Results     = results
            };

            return(View(model));
        }
예제 #18
0
        public ActionResult Index(string pcode)
        {
            var parliamentService = new ParliamentService();
            var parliamentId      = parliamentService.GetParliamentId(pcode);

            var service    = new LawService();
            var repService = new RepresentativeService();
            var model      = new LawHomeModel();

            model.LatestLaws       = service.GetLatestLaws(AppConfig.GetIntValue("JavnaRasprava.Index.LatestLaws", 5), parliamentId);
            model.LatestLaws.Title = GlobalLocalization.LatestLawsTitle;

            model.MostActive       = service.GetMostActive(AppConfig.GetIntValue("JavnaRasprava.Index.MostActive", 5), parliamentId);
            model.MostActive.Title = GlobalLocalization.MostActiveLawsTitle;

            model.NextLawsInVote       = service.GetNextLawsInVote(AppConfig.GetIntValue("JavnaRasprava.Index.NextLawsInVote", 5), parliamentId);
            model.NextLawsInVote.Title = GlobalLocalization.NextLawsInVoteTitle;

            model.TopRepresentatives = repService.GetTopRepresentatives(Infrastructure.AppConfig.GetIntValue("JavnaRasprava.Index.TopRepresentatives", 5), parliamentId);

            model.Search = service.InitializeSearchModel();

            return(View(model));
        }
예제 #19
0
        public void GetParliaments_All_Returned()
        {
            var response = new ParliamentService().GetParliaments();

            Assert.AreEqual(3, response.Parliaments.Count);
        }