コード例 #1
0
        public async Task <IActionResult> Create([Bind("DoctorID,FirstName,LastName,LoginID")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("PatientID,DoctorID,FirstName,LastName,HealthCardNum,BirthDate")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorID"] = new SelectList(_context.Doctors, "DoctorID", "DoctorID", patient.DoctorID);
            return(View(patient));
        }