Beispiel #1
0
        public async Task <IActionResult> PostNewVote([FromBody] VoteRawModel voteModelRaw)
        {
            if (ModelState.IsValid)
            {
                if (voteModelRaw != null)
                {
                    try
                    {
                        await _sendToEventHubService.SendMessageToEventHub(EhEntityPathVoteRaw, voteModelRaw);

                        //TODO Insertar y recuperar valores
                        var votingResults = new VotingResultsModel
                        {
                            PositiveVote = new Random().Next(10, 20),
                            NegativeVote = new Random().Next(1, 9)
                        };
                        await _sendToEventHubService.SendMessageToEventHub(EhEntityPathVotingResults, votingResults);

                        return(Ok());
                    }
                    catch (Exception ex)
                    {
                        //Log.Info($"Internal Server Error - {ex.Message}");
                        return(StatusCode(500));
                    }
                }

                return(BadRequest());
            }

            return(BadRequest());
        }
Beispiel #2
0
        public ActionResult FilterSectionVotingDetails(VotingResultsModel model)
        {
            TryUpdateModel(model);

            VotingService service = new VotingService();

            model            = service.GetResultsForLawSection(model);
            model.ActionName = "FilterSectionVotingDetails";

            return(PartialView("_VotingDetails", model));
        }
Beispiel #3
0
 public OrganizationViewModel()
 {
     Members            = new List <MemberModel>();
     UnconfirmedMembers = new List <UserLinkModel>();
     InvitedUsers       = new List <InviteUserModel>();
     UsersToInvite      = new List <InviteUserModel>();
     Ideas    = new IdeaIndexModel();
     Issues   = new VotingIndexModel();
     Results  = new VotingResultsModel();
     Problems = new ProblemIndexModel();
 }
Beispiel #4
0
        public ActionResult GetSectionVotingDetails(int id)
        {
            VotingService      service = new VotingService();
            VotingResultsModel model   = service.GetResultsForLawSection(new VotingResultsModel {
                ID = id
            });

            model.ActionName = "FilterSectionVotingDetails";

            return(PartialView("_VotingDetails", model));
        }
Beispiel #5
0
        public Models.VotingResultsModel PrepareFilters()
        {
            using (var context = JavnaRasprava.WEB.DomainModels.ApplicationDbContext.Create())
            {
                var result = new VotingResultsModel
                {
                    Parties   = UserService.GetAllPartiesSelectListInternal(context),
                    Locations = UserService.GetAllLocationsSelectListInternal(context)
                };

                return(result);
            }
        }