public async Task <IActionResult> DeleteAll()
        {
            _context.Reminders.RemoveRange(_context.Reminders);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", new { deletedAll = true }));
        }
示例#2
0
        public async Task <ActionResult <Reminder> > CreateReminder(Reminder reminder)
        {
            _context.Reminders.Add(reminder);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetReminder), new { id = reminder.Id }, reminder));
        }
示例#3
0
        public async Task <ReminderJob> AddAsync(ReminderJob item)
        {
            var newJob = await _context.ReminderJobs.AddAsync(item);

            await _context.SaveChangesAsync();

            return(newJob.Entity);
        }
示例#4
0
        public async Task <Reminder> AddAsync(Reminder item)
        {
            var newReminder = await _context.Reminders.AddAsync(item);

            await _context.SaveChangesAsync();

            return(newReminder.Entity);
        }
示例#5
0
        public async Task <Author> AddAsync(Author item)
        {
            var newAuthor = await _context.Authors.AddAsync(item);

            await _context.SaveChangesAsync();

            return(newAuthor.Entity);
        }
示例#6
0
        public async Task <IActionResult> CreateReminder([FromBody] Model.Reminder reminder)
        {
            var reminderNotification = new Model.Reminder
            {
                UserId  = reminder.UserId,
                Message = reminder.Message,
                EmailTo = reminder.EmailTo,
                Date    = reminder.Date
            };

            _reminderContext.Reminders.Add(reminderNotification);

            await _reminderContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetById), new { id = reminderNotification.Id }, null));
        }