Пример #1
0
        public async Task <IActionResult> Create([Bind("PatientID,Name,Gender")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("DepartmentID,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("DoctorID,Name,DepartmentID")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentID"] = new SelectList(_context.Department, "DepartmentID", "Name", doctor.DepartmentID);
            return(View(doctor));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("MedicalRecordID,Date,DoctorID,PatientID,PatientCondition,Indications")] MedicalRecord medicalRecord)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medicalRecord);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorID"]  = new SelectList(_context.Doctor, "DoctorID", "Name", medicalRecord.DoctorID);
            ViewData["PatientID"] = new SelectList(_context.Patient, "PatientID", "Name", medicalRecord.PatientID);
            return(View(medicalRecord));
        }