public async Task <IActionResult> Edit(int id, PatientReservation patientReservation) { if (id != patientReservation.Id) { return(NotFound()); } try { _context.Update(patientReservation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientReservationExists(patientReservation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); var patientTypes = _context.PatientTypes.ToList(); ViewBag.PatientType = patientTypes; return(View(patientReservation)); }
public async Task <IActionResult> Create(PatientReservation patientReservation) { patientReservation.EmployeeId = 1; patientReservation.CreatedDate = DateTime.Now; patientReservation.FildeId = GenerateFileId(); var attachFile = TempData["NationalId"] as AttachFile; if (attachFile != null) { patientReservation.NationalId = attachFile.FilePath; } _context.Add(patientReservation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }