public IActionResult VerifyPatients(int id) { var patient = _context.Patients.Where(p => p.Id == id).FirstOrDefault(); var patientViewModel = new PatientVerificationViewModel() { PatientId = id, FullName = patient.FullName }; return(View(patientViewModel)); }
public IActionResult VerifyPatients(int id, PatientVerificationViewModel model) { if (ModelState.IsValid) { var patient = _context.Patients.Where(p => p.Id == model.PatientId).FirstOrDefault(); if (model.IsVerified == true) { patient.IsVerified = true; } else if (model.IsNotVerified == true) { patient.Hospital_AdministratorId = null; } _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(model)); }