예제 #1
0
        public async Task <EventVote> CaptureUserVote(EventVote eventvote)
        {
            var azureclient = _azureClient.GetClient(Globals.EVENT_VOTE, string.Empty, string.Empty);
            var table       = _cloudService.GetTable <EventVote>(azureclient);
            var list        = await table.CreateItemAsync(eventvote);

            return(list);
        }
예제 #2
0
        private async Task DanceVote(object args)
        {
            var       DanceListItemClicked = args as Event;
            EventVote ev = new EventVote();

            ev.EventId     = DanceListItemClicked.Id;
            ev.EventTypeId = DanceListItemClicked.EventTypeId;
            ev.CreatedBy   = GetUDID();
            var udid = GetUDID();

            ev.EventUserDevices = new List <EventUserDevice>()
            {
                new EventUserDevice()
                {
                    EventId = DanceListItemClicked.Id, UDID = udid, CreatedBy = udid
                }
            };
            var result = await _eventBusinesservice.CaptureUserVote(ev);

            if (result != null)
            {
                if (result.isVoteCapturedSuccessfully == false)
                {
                    UserDialogs.Instance.HideLoading();

                    IsDanceVotingEnabled = false;
                    //await _navigationService.DisplayAlert("Voting Lines", "The Voting Lines are currently closed. Please contact the organizers.", "OK");
                }
                else
                {
                    IsDanceVoted = true;
                }
            }
            else
            {
                await _navigationService.DisplayAlert("Error in voting", "There was an error in submitting your vote. Please contact the organizers.", "OK");
            }
        }
예제 #3
0
        public async Task VoteAsync(int eventId, string userId, bool isUpVote)
        {
            var vote = this.votesRepository.All()
                       .FirstOrDefault(x => x.EventId == eventId && x.UserId == userId);

            if (vote != null)
            {
                vote.Type = isUpVote ? VoteType.UpVote : VoteType.Neutral;
            }
            else
            {
                vote = new EventVote
                {
                    EventId = eventId,
                    UserId  = userId,
                    Type    = isUpVote ? VoteType.UpVote : VoteType.Neutral,
                };

                await this.votesRepository.AddAsync(vote);
            }

            await this.votesRepository.SaveChangesAsync();
        }
예제 #4
0
 public async Task <EventVote> CaptureUserVote(EventVote vote)
 {
     return(await _eventRestApi.CaptureUserVote(vote));
 }