public async Task <IActionResult> Create([Bind("HospitalId,HospitalName,Address,City,State,Zip,PhoneNumber,WebsiteUrl,Hours,HasEmergencyRoom")] Hospitals hospitals) { if (ModelState.IsValid) { _context.Add(hospitals); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hospitals)); }
public async Task <IActionResult> Create([Bind("DepartmentId,DepartmentName,HospitalId")] Departments departments) { if (ModelState.IsValid) { _context.Add(departments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HospitalId"] = new SelectList(_context.Hospitals, "HospitalId", "HospitalId", departments.HospitalId); return(View(departments)); }