// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { Locations = _htmlHelper.GetEnumSelectList <City>(); Infected = _htmlHelper.GetEnumSelectList <Infected>(); PatientState = _htmlHelper.GetEnumSelectList <PatientState>(); Hospitals = new SelectList(_context.Hospitals.ToList(), "Id", "HospitalName", Patient.Hospital); if (!ModelState.IsValid) { return(Page()); } _context.Attach(Patient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientExists(Patient.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Hospital).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HospitalExists(Hospital.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }