Exemplo n.º 1
0
        public ActionResult CandidateChecking(CheckingViewModel checkingViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            var candidate = dbContext.Units.FirstOrDefault(c => c.UnitNumber == checkingViewModel.UnitNumber);

            if (candidate == null)
            {
                checkingViewModel.ErrorMessage = "Not a resident of RWA";
                return(View("CandidateChecking", checkingViewModel));
            }
            else
            {
                if (candidate.Name == checkingViewModel.Name && checkingViewModel.Age >= 21)
                {
                    return(RedirectToAction("Register"));
                }
                else
                {
                    checkingViewModel.ErrorMessage = "Not Eligible to participate in election";
                    return(View("CandidateChecking", checkingViewModel));
                }
            }
        }
Exemplo n.º 2
0
 public ActionResult Edit(CheckingViewModel checking)
 {
     if (ModelState.IsValid)
     {
         _unitOfWork.Checking_List.EditWithPassengers(CheckingMapper.Map(checking), checking.Passengers);
         Ok();
         return(RedirectToAction("Index", "checking", null));
     }
     Forbidden();
     return(Content(GenerateError()));
 }