Exemplo n.º 1
0
        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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
 public Applicant Add(Applicant newApplicant)
 {
     db.Add(newApplicant);
     return(newApplicant);
 }