public async Task <ActionResult> Create(CreateCandidateModel account)
        {
            if (ModelState.IsValid)
            {
                var id = await _candidateService.CreateCandidate(account);

                return(RedirectToAction("Details", "Candidate", new { id }));
            }

            return(View(account));
        }
        public async Task <string> CreateCandidate(CreateCandidateModel candidate)
        {
            var dbCandidate = new Candidate
            {
                FirstName   = candidate.FirstName,
                LastName    = candidate.LastName,
                Description = candidate.Description
            };

            await MvcApplication.ElectionsContext.Candidates.InsertOneAsync(dbCandidate);

            var id = dbCandidate._id.ToString();

            _logger.Debug($"Candidate {id} created.");

            return(id);
        }
        public ActionResult Create()
        {
            var accountModel = new CreateCandidateModel();

            return(View(accountModel));
        }