示例#1
0
        private PollViewModel CreateViewModel(Dictionary <string, string> values)
        {
            PollViewModel vm = new PollViewModel();

            vm.Poll = new Domain.Entities.Poll()
            {
                Description  = values["Poll.Description"],
                PollQuestion = values["Poll.PollQuestion"],
                Meta         = values["Poll.Meta"],
                UrlSlug      = values["Poll.UrlSlug"],
                CategoryID   = int.Parse(values["SelectedCategoryId"]),
            };

            vm.Options = values
                         .Where(x => x.Key.Contains("OptionObject"))
                         .Where(x => x.Key.Contains("Text"))
                         .Select(x => new Domain.Entities.Option
            {
                Text = x.Value
            });

            vm.SelectedCategoryId = int.Parse(values["SelectedCategoryId"]);

            return(vm);
        }
示例#2
0
        public PollPage()
        {
            InitializeComponent();

            BindingContext = new PollViewModel();
            PollListView.BeginRefresh();
        }
示例#3
0
        public ActionResult New(PollViewModel poll, HttpPostedFileBase poll_image)
        {
            ViewBag.SelectedPage = Navigator.Items.NEWPOLL;
            FillPollCampaigns(poll.CampaignId);

            if (ModelState.IsValid)
            {
                if (poll_image != null && !ImageService.IsValid(poll_image))
                {
                    TempData["ErrorMessage"] = "Poll Failed To Add, Invalid Image File";
                }
                else
                {
                    int new_id = servicesManager.PollService.AddNewPoll(poll, poll_image);

                    if (new_id > 0)
                    {
                        TempData["SuccessMessage"] = "Poll Added Successfully";
                        return(RedirectToAction("Edit", new { id = new_id }));
                    }
                    else
                    {
                        TempData["ErrorMessage"] = "Poll Failed To Add";
                    }
                }
            }

            return(View(poll));
        }
示例#4
0
        public IActionResult GetPollByGuid(string guid)
        {
            PollViewModel pollView = new PollViewModel();

            if (_memoryCache.TryGetValue("poll_guid_" + guid.ToString(), out pollView))
            {
                return(Ok(pollView));
            }

            Poll poll = _dBContext.Poll.Where(x => x.PollGuid.Trim().Equals(guid.Trim())).FirstOrDefault();

            if (poll == null)
            {
                return(NotFound(Messages.PollNotFoundError));
            }
            if (poll.Enddate <= DateTime.Now.Date.AddDays(1).AddSeconds(-1))
            {
                return(BadRequest(Messages.PollEnded));
            }

            pollView = _mapper.Map <PollViewModel>(poll);

            List <PollOptions> options = _dBContext.PollOptions.Where(x => x.PollId == poll.PollId).ToList();

            pollView.PollOptions = options;
            _memoryCache.Set($"poll_guid_{guid}", pollView);
            return(Ok(pollView));
        }
        public ActionResult Polling(int pollId)
        {
            PollViewModel vm = new PollViewModel();

            vm.PollId = pollId;
            return(View(vm));
        }
示例#6
0
        public IActionResult PollResult(PollViewModel model)
        {
            string userIp = _accessor.HttpContext.Connection.RemoteIpAddress.ToString();

            _pollsRepository.InsertVote(model.SelectedOptionId, model.Id, userIp);
            _unitOfWork.Commit();

            Poll poll = _pollsRepository.GetPollById(model.Id);
            List <PollOption> options = _pollsRepository.GetOptions(model.Id);
            int totalVotes            = options.Sum(o => o.Votes);

            var pollResult = new PollResultViewModel
            {
                QuestionText = poll.QuestionText,
                TotalVotes   = totalVotes,
                Items        = options.Select(option => new PollResultItemViewModel
                {
                    AnswerText = option.OptionText,
                    Votes      = option.Votes,
                    Percentage = Math.Round((double)100 / totalVotes * option.Votes, 1)
                })
            };

            ViewBag.IsPostBack = true;

            return(View(pollResult));
        }
示例#7
0
        // GET: Admin/Poll
        public ActionResult CreatePoll()
        {
            var pollViewModel = new PollViewModel();

            pollViewModel.departs = _departmentInfoAppService.GetAllDepartmentInfos();
            return(View(pollViewModel));
        }
示例#8
0
        public ActionResult SetUsers(int pollId)
        {
            var examViewModel = new PollViewModel();

            examViewModel.PollId = pollId;
            return(View("~/Areas/Admin/Views/Poll/SetUsers.cshtml", examViewModel));
        }
        private PollViewModel SetPoll(Guid currentUserId, Guid contentId)
        {
            PollViewModel pollVm = null;
            Poll          poll   = pollDomainService.GetByUserContentId(contentId);

            if (poll != null)
            {
                pollVm = new PollViewModel();

                int totalVotes = poll.Votes.Count;
                pollVm.TotalVotes = totalVotes;

                foreach (PollOption option in poll.Options)
                {
                    PollOptionViewModel loadedOption = new PollOptionViewModel
                    {
                        Id   = option.Id,
                        Text = option.Text
                    };

                    loadedOption.Votes            = poll.Votes.Count(x => x.PollOptionId == option.Id);
                    loadedOption.VotePercentage   = loadedOption.Votes > 0 ? (loadedOption.Votes / (decimal)totalVotes) * 100 : 0;
                    loadedOption.CurrentUserVoted = poll.Votes.Any(x => x.PollOptionId == option.Id && x.UserId == currentUserId);

                    pollVm.PollOptions.Add(loadedOption);
                }
            }

            return(pollVm);
        }
示例#10
0
        public void Perticipents(PollViewModel Data, List <string> inviteesIds)
        {
            try
            {
                PerticipentModel        member     = new PerticipentModel();
                List <PerticipentModel> MemberList = new List <PerticipentModel>();


                foreach (var id in inviteesIds)
                {
                    MemberList.Add(new PerticipentModel()
                    {
                        ActivityId    = Data.Id,
                        PerticipentId = id,
                        // AnswerId = 0
                    });
                }
                _data.Perticipents.AddRange(MemberList);
                _data.SaveChanges();
            }

            catch (Exception ex)
            {
                throw;
            }
        }
示例#11
0
        public PollViewModel SinglePoll(int id)
        {
            PollViewModel poll = new PollViewModel();

            try
            {
                var y = _data.PollingAndSyrvays.FirstOrDefault(x => x.Id == id && x.Name == "Poll");
                if (y.EndDate >= DateTime.Now && y.StartDate <= DateTime.Now && (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    if (Current_User_id == y.CreatorId || System.Web.HttpContext.Current.User.IsInRole("Administrator"))
                    {
                        var z = _data.Questions.FirstOrDefault(x => x.ActivityId == y.Id && x.ActivityName == "Poll");

                        poll.Id          = id;
                        poll.Title       = y.Title;
                        poll.Description = y.Description;
                        poll.Question    = z.Question;
                        poll.StartDate   = y.StartDate;
                        poll.EndDate     = y.EndDate;
                        return(poll);
                    }
                }


                return(poll);
            }

            catch
            {
                return(poll);
            }
        }
示例#12
0
        public PollViewModel  GetPollById(int poll_id)
        {
            var poll = DAManager.PollsRepository.Get(p => p.PollId == poll_id, null, "PollAnswers").FirstOrDefault();

            if (poll != null)
            {
                PollViewModel poll_viewmodel = new PollViewModel()
                {
                    Description = poll.Description, CampaignId = poll.CampaignId, IsPublished = poll.IsPublished, OnlineEndDate = poll.OnlineEndDate, OnlineStartDate = poll.OnlineStartDate, PollId = poll_id, Question = poll.Question, Type = poll.Type, ImageURL = poll.ImageURL
                };
                poll_viewmodel.Answers = new List <PollAnswerViewModel>();
                foreach (PollAnswer pa in poll.PollAnswers)
                {
                    poll_viewmodel.Answers.Add(new PollAnswerViewModel()
                    {
                        Answer = pa.Answer, IsCorrect = pa.IsCorrect, PollAnswerId = pa.AnswerId, PollId = pa.PollId
                    });
                }
                return(poll_viewmodel);
            }
            else
            {
                return(null);
            }
        }
示例#13
0
        private void CreateLayout()
        {
            this._pvm = new PollViewModel(this._poll, this._topicId);
            this._pvm.PropertyChanged += new PropertyChangedEventHandler(this.pvm_PropertyChanged);
            TextItem textItem = new TextItem(this.Width, new Thickness(16.0, 0.0, 16.0, 0.0), this._pvm.Question, true, 20.0, "Segoe WP Semibold", VKConstants.LineHeight, null, true, null);

            this.VirtualizableChildren.Add((IVirtualizable)textItem);
            this._pollDescriptionTextItem = new TextItem(this.Width, new Thickness(16.0, textItem.FixedHeight, 16.0, 0.0), string.Format("{0}, {1}", this._pvm.PollTypeStr, this._pvm.VotedCountStr), false, 20.0, "Segoe WP", 0.0, Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush, true, null);
            this.VirtualizableChildren.Add((IVirtualizable)this._pollDescriptionTextItem);
            PollUC pollUc = new PollUC();
            double width  = this.Width;

            ((FrameworkElement)pollUc).Width = width;
            double    num1    = 0.0;
            Thickness margin1 = this._pollDescriptionTextItem.Margin;
            // ISSUE: explicit reference operation
            double    num2      = margin1.Top + this._pollDescriptionTextItem.FixedHeight + 2.0;
            double    num3      = 0.0;
            double    num4      = 0.0;
            Thickness thickness = new Thickness(num1, num2, num3, num4);

            ((FrameworkElement)pollUc).Margin = thickness;
            this._pollUC = pollUc;
            this._pollUC.Initialize(this._poll, this._topicId);
            Thickness margin2 = ((FrameworkElement)this._pollUC).Margin;

            // ISSUE: explicit reference operation
            this._fixedHeight = ((Thickness)@margin2).Top + this._pollUC.CalculateTotalHeight() + 4.0;
        }
示例#14
0
        /// <summary>
        /// Usage:
        /// Method for obtaining all Polls.
        /// <see cref="GetAll()"/>
        /// </summary>
        /// <returns>PollViecModel.</returns>
        public PollViewModel GetAll()
        {
            using (var context = new BlogContext())
            {
                PollViewModel pollsToDisplay = new PollViewModel();
                var           polls          = context.Polls.ToList();

                List <PollItem> allPolls = new List <PollItem>();
                foreach (var poll in polls)
                {
                    allPolls.Add(
                        new PollItem()
                    {
                        Id          = poll.PollId,
                        Genre       = poll.Genre,
                        Age         = poll.Age,
                        Proposals   = poll.Proposals,
                        MusicGenres = poll.MusicGenres,
                        Content     = poll.Content
                    }
                        );
                }
                pollsToDisplay.PollItems = allPolls;
                return(pollsToDisplay);
            }
        }
示例#15
0
        public IViewComponentResult Invoke()
        {
            var    model    = new PollViewModel();
            string userIp   = _accessor.HttpContext.Connection.RemoteIpAddress.ToString();
            Guid   pollId   = _pollsRepository.GetCurrentPollId();
            bool   showPoll = _pollsRepository.ShowPoll(userIp, pollId);

            if (ViewBag.IsPostBack != null)
            {
                model.IsPostBack = (bool)ViewBag.IsPostBack;
                if (model.IsPostBack)
                {
                    model.Congratulation = string.Empty;
                }
                return(View(model));
            }

            showPoll = true;

            if (showPoll)
            {
                Poll poll = _pollsRepository.GetPollById(pollId);
                if (poll != null)
                {
                    model          = _mapper.Map <PollViewModel>(poll);
                    model.ShowPoll = true;
                    if (poll.PollOptions.Any())
                    {
                        model.Options = _mapper.Map <List <OptionViewModel> >(poll.PollOptions);
                    }
                }
            }
            return(View(model));
        }
示例#16
0
        public IActionResult AddNewPoll([FromBody] NewPollViewModel newPoll)
        {
            string userId = Request.Headers[Constants.UserToken];
            User   user;

            _memoryCache.TryGetValue(userId, out user);
            if (user == null)
            {
                return(Unauthorized(Messages.UserNotFoundError));
            }

            Poll p = _mapper.Map <Poll>(newPoll);

            p.CreatedDate = DateTime.UtcNow;
            p.CreatedBy   = user.Userid;

            _dBContext.Poll.Add(p);
            _dBContext.SaveChanges();

            List <PollOptions> lstPollOptions = new List <PollOptions>();

            int order = 0;

            foreach (var item in newPoll.options)
            {
                PollOptions options = new PollOptions();
                options.PollId      = p.PollId;
                options.OptionText  = item;
                options.StatusId    = p.StatusId;
                options.CreatedBy   = user.Userid;
                options.CreatedDate = DateTime.UtcNow;
                options.OrderId     = order;
                lstPollOptions.Add(options);
                order++;
            }

            _dBContext.PollOptions.AddRange(lstPollOptions);
            _dBContext.SaveChanges();

            PollViewModel pCache = _mapper.Map <PollViewModel>(p);

            pCache.PollOptions = lstPollOptions;

            _memoryCache.Set($"dbpoll_id_{p.PollId}", p);
            _memoryCache.Set($"poll_guid_{p.PollGuid}", pCache);
            _memoryCache.Set($"poll_id_{p.PollId}", pCache);
            _memoryCache.Remove($"poll_userpoll_userid_{user.UserGuid}");

            DashboardMetricsViewModel dashboardMetricsViewModel;

            _memoryCache.TryGetValue($"dashboard_{user.UserGuid}", out dashboardMetricsViewModel);
            if (dashboardMetricsViewModel != null)
            {
                dashboardMetricsViewModel.polls += 1;
                _memoryCache.Set($"dashboard_{user.UserGuid}", dashboardMetricsViewModel);
            }

            return(GetPoll(p.PollId));
        }
 public void DisplayPoll(PollViewModel poll)
 {
     if (viewModel != null && poll != null)
     {
         //SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
         viewModel.Poll = poll;
     }
 }
示例#18
0
        // GET: Admin/Poll
        public ActionResult QuestionPoll(int pollId)
        {
            var pollViewModel = new PollViewModel();

            pollViewModel.PollId  = pollId;
            pollViewModel.departs = _departmentInfoAppService.GetAllDepartmentInfos();
            return(View(pollViewModel));
        }
        public void UpsertInvalidModelShouldRedirectToSamePage()
        {
            var model = new PollViewModel();

            SimulateValidation(model, pollController);
            var result = pollController.Upsert(model);

            result.Should().BeOfType(typeof(ViewResult));
        }
        public IActionResult ShowPolls()
        {
            //int pollId = -1;
            DateTime time = DateTime.UtcNow;

            List <Poll> polls = db.Poll.Where(p => p.End > time).Where(p => p.NeedsLocalCouncil == false).Where(p => p.Approved == true).Include("Category").ToList();

            foreach (Poll poll in polls)
            {
                List <AnswerOptionsPoll> answers = db.AnswerOptionsPoll.Where(aop => aop.PollId == poll.Id)
                                                   .Include("AnswerOptions")
                                                   .Where(aop => aop.AnswerOptionsId == aop.AnswerOptions.Id).Select(aop => new AnswerOptionsPoll
                {
                    Id = aop.Id,
                    AnswerOptionsId = aop.AnswerOptionsId,
                    PollId          = aop.PollId,
                    AnswerOptions   = aop.AnswerOptions
                }
                                                                                                                     ).ToList();
                poll.AnswerOptionsPoll = answers;
            }
            ICollection <PollViewModel> pollViewModels = new List <PollViewModel>();

            foreach (Poll poll in polls)
            {
                PollViewModel pollViewModel = new PollViewModel();

                pollViewModel.Id   = poll.Id;
                pollViewModel.Text = poll.Text;
                if (pollViewModel.End == null)
                {
                    pollViewModel.End = DateTime.UtcNow;
                }
                else
                {
                    pollViewModel.End = (DateTime)poll.End;
                }

                pollViewModel.UserId            = poll.UserId;
                pollViewModel.NeedsLocalCouncil = poll.NeedsLocalCouncil;
                pollViewModel.Approved          = poll.Approved;
                pollViewModel.CategoryId        = poll.CategoryId;
                pollViewModel.Title             = poll.Title;
                pollViewModel.Category          = poll.Category;
                pollViewModel.User = poll.User;
                pollViewModel.AnswerOptionsPoll = poll.AnswerOptionsPoll;
                pollViewModel.RadioId           = 0;


                pollViewModels.Add(pollViewModel);
            }

            return(View("PollsView", pollViewModels));
        }
示例#21
0
        public IActionResult Create(PollViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model));
            }

            this.pollService.CreatePoll(model);

            return(this.Redirect("/Polls/All"));
        }
示例#22
0
        public IActionResult GetPoll(int id)
        {
            Poll poll = _dBContext.Poll.Where(x => x.PollId == id).FirstOrDefault();

            PollViewModel pollView = _mapper.Map <PollViewModel>(poll);


            List <PollOptions> options = _dBContext.PollOptions.Where(x => x.PollId == id).ToList();

            pollView.PollOptions = options;
            return(Ok(pollView));
        }
示例#23
0
        public ActionResult CreatePoll(PollViewModel Poll, FormCollection frm)
        {
            var invitees = new List <string>();

            if (!string.IsNullOrEmpty(frm["invitees"]))
            {
                invitees = frm["invitees"].Split(',').ToList();
            }

            var result = _surveyManager.CreatePoll(Poll, invitees);

            return(Content(result.ToString()));
        }
示例#24
0
        public ActionResult AdminPoll(string password)
        {
            PollViewModel pvm = new PollViewModel();
            Question      q   = new Question();

            q = db.Questions.First(x => x.Password == password);

            pvm.Question = q;

            pvm.Answers = db.Answers.Where(x => x.QuestionID == q.QuestionID).ToArray();


            return(View(pvm));
        }
示例#25
0
        public ActionResult PollResults(string shortURL)
        {
            PollViewModel pvm = new PollViewModel();
            Question      q   = new Question();

            q = db.Questions.First(x => x.ShortURL == shortURL);

            pvm.Question = q;

            pvm.Answers = db.Answers.Where(x => x.QuestionID == q.QuestionID).ToArray();


            return(View(pvm));
        }
示例#26
0
        //
        //GET: /Admin/AdminPoll/Edit/{category-id}
        public ActionResult Edit(int id)
        {
            ViewBag.SelectedPage = Navigator.Items.POLLS;
            PollViewModel tip = servicesManager.PollService.GetPollById(id);

            FillPollCampaigns(tip.CampaignId);

            if (tip == null)
            {
                return(RedirectToAction("List"));
            }

            return(View(tip));
        }
示例#27
0
        //
        //GET: /Admin/AdminPoll/New
        public ActionResult New()
        {
            ViewBag.SelectedPage = Navigator.Items.NEWPOLL;
            FillPollCampaigns(null);

            PollViewModel view_model = new PollViewModel()
            {
                OnlineStartDate = DateTime.Now, OnlineEndDate = DateTime.Now
            };

            view_model.Answers = new List <PollAnswerViewModel>();
            view_model.Answers.Add(new PollAnswerViewModel());
            return(View(view_model));
        }
示例#28
0
        public ActionResult Index([Bind(Include = "Genre, Age, MusicGenres, Content, Proposals")] PollViewModel vPollModel)
        {
            var repo = new PollRepository();

            if (ModelState.IsValid)
            {
                repo.SavePoll(vPollModel);
            }
            else
            {
                return(View("~/Views/Poll/Index.cshtml", vPollModel));
            }
            return(View(repo.GetAll()));
        }
        public ActionResult CreatePoll(PollViewModel poll)
        {
            // Create a new Poll and Choices with values posted
            var newPoll     = Services.ContentManager.New("Poll");
            var newPollPart = newPoll.As <PollPart>();

            if (!ModelState.IsValid)
            {
                Services.TransactionManager.Cancel();
                Services.Notifier.Information(T("Der opstod en fejl ved validering af data - kontakt evt. [email protected]"));
                return(View("EditorTemplates/Parts/PollForm", poll));
            }

            if (ModelState.IsValid)
            {
                // Set title for item - important!
                newPollPart.As <TitlePart>().Title = poll.Question;

                newPollPart.Question              = poll.Question;
                newPollPart.OpenDateUtc           = poll.Open;
                newPollPart.CloseDateUtc          = poll.Close;
                newPollPart.MaxVotes              = poll.MaxVotes;
                newPollPart.IsShown               = poll.Shown;
                newPollPart.ShowVotingUI          = poll.ShowVotingUI;
                newPollPart.IsMusicPoll           = poll.MusicPoll;
                newPollPart.IsMusicPollInTestMode = poll.MusicPollInTestMode;

                foreach (ChoiceEntry c in poll.Choices)
                {
                    if (c.Choice.Answer != null && c.Choice.Answer.Length > 0)
                    {
                        var choice = new PollChoiceRecord
                        {
                            Answer         = c.Choice.Answer,
                            PollPartRecord = newPollPart.Record
                        };
                        _pollService.CreateChoice(choice);
                    }
                }
            }

            // Persist new poll content item (publish)
            Services.ContentManager.Create(newPoll);
            Services.Notifier.Information(T("Din afstemning er nu oprettet"));

            // var model = new PollViewModel(newPollPart, poll.Choices);
            // return View("Parts/Poll", model);
            return(RedirectToAction("Index"));
        }
示例#30
0
        public virtual PartialViewResult UpdatePoll(UpdatePollViewModel updatePollViewModel)
        {
            try
            {
                User.GetMembershipUser(MembershipService);

                // Fist need to check this user hasn't voted already and is trying to fudge the system
                if (LoggedOnReadOnlyUser != null && !_pollService.HasUserVotedAlready(updatePollViewModel.AnswerId, LoggedOnReadOnlyUser.Id))
                {
                    var loggedOnUser = MembershipService.GetUser(LoggedOnReadOnlyUser?.Id);

                    // Get the answer
                    var pollAnswer = _pollService.GetPollAnswer(updatePollViewModel.AnswerId);

                    // create a new vote
                    var pollVote = new PollVote {
                        PollAnswer = pollAnswer, User = loggedOnUser
                    };

                    // Add it
                    _pollService.Add(pollVote);

                    // Update the context so the changes are reflected in the viewmodel below
                    Context.SaveChanges();
                }

                // Create the view model and get ready return the poll partial view
                var poll         = _pollService.Get(updatePollViewModel.PollId);
                var votes        = poll.PollAnswers.SelectMany(x => x.PollVotes).ToList();
                var alreadyVoted = votes.Count(x => x.User.Id == LoggedOnReadOnlyUser?.Id) > 0;
                var viewModel    = new PollViewModel
                {
                    Poll                = poll,
                    TotalVotesInPoll    = votes.Count(),
                    UserHasAlreadyVoted = alreadyVoted
                };

                // Commit the transaction
                Context.SaveChanges();

                return(PartialView("_Poll", viewModel));
            }
            catch (Exception ex)
            {
                Context.RollBack();
                LoggingService.Error(ex);
                throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
            }
        }
示例#31
0
        public PartialViewResult UpdatePoll(UpdatePollViewModel updatePollViewModel)
        {
            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                try
                {
                    // Fist need to check this user hasn't voted already and is trying to fudge the system
                    if(!_pollVoteService.HasUserVotedAlready(updatePollViewModel.AnswerId, LoggedOnReadOnlyUser.Id))
                    {
                        var loggedOnUser = MembershipService.GetUser(LoggedOnReadOnlyUser.Id);

                        // Get the answer
                        var pollAnswer = _pollAnswerService.Get(updatePollViewModel.AnswerId);

                        // create a new vote
                        var pollVote = new PollVote { PollAnswer = pollAnswer, User = loggedOnUser };

                        // Add it
                        _pollVoteService.Add(pollVote);

                        // Update the context so the changes are reflected in the viewmodel below
                        unitOfWork.SaveChanges();
                    }

                    // Create the view model and get ready return the poll partial view
                    var poll = _pollService.Get(updatePollViewModel.PollId);
                    var votes = poll.PollAnswers.SelectMany(x => x.PollVotes).ToList();
                    var alreadyVoted = (votes.Count(x => x.User.Id == LoggedOnReadOnlyUser.Id) > 0);
                    var viewModel = new PollViewModel { Poll = poll, TotalVotesInPoll = votes.Count(), UserHasAlreadyVoted = alreadyVoted };

                    // Commit the transaction
                    unitOfWork.Commit();

                    return PartialView("_Poll", viewModel);
                }
                catch (Exception ex)
                {
                    unitOfWork.Rollback();
                    LoggingService.Error(ex);
                    throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
                }
            }
        }