Ejemplo n.º 1
0
        // GET: Votings/Details/5
        public ActionResult Details(int?id)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}

            Voting voting = db.Votings.Find(id);

            if (voting == null)
            {
                return(HttpNotFound());
            }

            var view = new DetailsVotingView
            {
                Candidates         = voting.Candidates.ToList(),
                CandidateWinId     = voting.CandidateWinId,
                DateTimeEnd        = voting.DateTimeEnd,
                DateTimeStart      = voting.DateTimeStart,
                Description        = voting.Description,
                IsEnabledBlankVote = voting.IsEnabledBlankVote,
                IsForAllUsers      = voting.IsForAllUsers,
                QuantityBlankVotes = voting.QuantityBlankVotes,
                QuantityVotes      = voting.QuantityVotes,
                Remarks            = voting.Remarks,
                StateId            = voting.StateId,
                VotingGroups       = voting.VotingGroups.ToList(),
                VotingId           = voting.VotingId,
            };

            return(View(view));
        }
Ejemplo n.º 2
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Voting voting = db.Votings.Find(id);

            if (voting == null)
            {
                return(HttpNotFound());
            }

            var detailsView = new DetailsVotingView
            {
                votingId            = voting.votingId,
                description         = voting.description,
                stateId             = voting.stateId,
                remarks             = voting.remarks,
                dateTimeEnd         = voting.dateTimeEnd,
                dateTimeStart       = voting.dateTimeStart,
                isEnabledBlankVotes = voting.isEnabledBlankVotes,
                isForAllUsers       = voting.isForAllUsers,
                quantityBlankVotes  = voting.quantityBlankVotes,
                quantityVotes       = voting.quantityVotes,
                candidateWinId      = voting.candidateWinId,
                Candidates          = voting.Candidates.ToList(),
                VotingGroups        = voting.VotingGroups.ToList(),
            };

            return(View(detailsView));
        }