Ejemplo n.º 1
0
        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 }));
        }
Ejemplo n.º 2
0
        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 }));
        }