コード例 #1
0
ファイル: PatientController.cs プロジェクト: safaad/SDClinic
        public async Task <IActionResult> ReminderAdd(int ptid, Reminder_Patient rd)
        {
            ViewBag.id   = ptid;
            rd.PatientId = ptid;
            try
            {
                _context.Reminder_Patients.Add(rd);
                await _context.SaveChangesAsync();

                return(RedirectToAction("ReminderPage", new { id = ptid }));
            }
            catch (DbUpdateException)
            {
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }


            return(RedirectToAction("ReminderPage", new { id = ptid }));
        }
コード例 #2
0
ファイル: PatientController.cs プロジェクト: safaad/SDClinic
        public async Task <IActionResult> DeleteReminder(int ptId, int remId)
        {
            Reminder_Patient rd = _context.Reminder_Patients.Where(s => s.Id == remId).First();

            try
            {
                _context.Reminder_Patients.Remove(rd);
                await _context.SaveChangesAsync();

                return(RedirectToAction("ReminderPage", new { id = ptId }));
            }
            catch (DbUpdateException)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }

            await _context.SaveChangesAsync();

            return(RedirectToAction("ReminderPage", new { id = ptId }));
        }