コード例 #1
0
ファイル: DoctorController.cs プロジェクト: safaad/SDClinic
        public async Task <IActionResult> ReminderAdd(int drid, Reminder_Doctor rd)
        {
            ViewBag.id = drid;

            try
            {
                _context.Reminder_Doctors.Add(rd);
                await _context.SaveChangesAsync();

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


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

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

                return(RedirectToAction("ReminderPage", new { id = drId }));
            }
            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 = drId }));
        }