コード例 #1
0
 public async Task<IActionResult> Create([Bind("ID,NRIC,Name,Gender,DateOfBirth,Address,History")] Patients patients)
 {
     if (ModelState.IsValid)
     {
         _context.Add(patients);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(patients);
 }
コード例 #2
0
        public async Task <IActionResult> CreateHistory([Bind("ID,Patient,DateOfVisit,Illness,MedicationGiven,Price,Status")] History history)
        {
            if (ModelState.IsValid)
            {
                _context.Add(history);
                await _context.SaveChangesAsync();

                return(RedirectToAction("History", "Patients"));
            }
            return(RedirectToAction("History", "Patients"));
        }