public async Task <IActionResult> Create([Bind("Id,Name,Email")] Elector elector)
        {
            if (ModelState.IsValid)
            {
                _context.Add(elector);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(elector));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Applicant,ElectionCount")] ApplicantVotes applicantVotes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicantVotes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicantVotes));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,ApplicantProfileWebSite")] Applicant applicant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicant));
        }
        public async Task <IActionResult> Create([Bind("Id,ElectorId,ApplicantId")] Election election)
        {
            if (ModelState.IsValid)
            {
                _context.Add(election);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicantId"] = new SelectList(_context.Applicant, "Id", "Id", election.ApplicantId);
            ViewData["ElectorId"]   = new SelectList(_context.Set <Elector>(), "Id", "Id", election.ElectorId);
            return(View(election));
        }
Beispiel #5
0
 public Applicant Add(Applicant newApplicant)
 {
     db.Add(newApplicant);
     return(newApplicant);
 }