public async Task <IActionResult> CreateStep7([Bind("HealthPOA,PrimaryHealthAttorney,SecondaryHealthAttorney,Exit")] IntakeFormViewModel7 intakeFormViewModel) { //if (ModelState.IsValid) //{ VeteranIntakeForm currentForm = _context.VeteranIntakeForms.FirstOrDefault(form => form.VeteranApplicationUserId == _userManager.GetUserId(User) && form.IsCompleted == null ); //currentForm.CurrentStep = 8; currentForm.TimeStamp = DateTime.Now; currentForm.HealthPOA = intakeFormViewModel.HealthPOA; currentForm.PrimaryHealthAttorney = intakeFormViewModel.PrimaryHealthAttorney; currentForm.SecondaryHealthAttorney = intakeFormViewModel.SecondaryHealthAttorney; if (intakeFormViewModel.Exit != null) { _context.VeteranIntakeForms.Update(currentForm); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Veteran")); } currentForm.CurrentStep = 8; _context.VeteranIntakeForms.Update(currentForm); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(GoToStep), new { step = currentForm.CurrentStep })); //} //return View(nameof(CreateStep7)); }
public async Task <IActionResult> CreateStep7() { IntakeFormViewModel7 ifvm = new IntakeFormViewModel7(); VeteranIntakeForm veteranIntakeForm = _context.VeteranIntakeForms.FirstOrDefault(form => form.VeteranApplicationUserId == _userManager.GetUserId(User) && form.IsCompleted == null ); if (veteranIntakeForm != null) { ifvm.HealthPOA = veteranIntakeForm.HealthPOA; ifvm.PrimaryHealthAttorney = veteranIntakeForm.PrimaryHealthAttorney; ifvm.SecondaryHealthAttorney = veteranIntakeForm.SecondaryHealthAttorney; veteranIntakeForm.CurrentStep = 7; _context.Update(veteranIntakeForm); await _context.SaveChangesAsync(); return(View(ifvm)); } return(View(ifvm)); }