public async Task <IActionResult> DeleteAll() { _context.Reminders.RemoveRange(_context.Reminders); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { deletedAll = true })); }
public async Task <ActionResult <Reminder> > CreateReminder(Reminder reminder) { _context.Reminders.Add(reminder); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetReminder), new { id = reminder.Id }, reminder)); }
public async Task <ReminderJob> AddAsync(ReminderJob item) { var newJob = await _context.ReminderJobs.AddAsync(item); await _context.SaveChangesAsync(); return(newJob.Entity); }
public async Task <Reminder> AddAsync(Reminder item) { var newReminder = await _context.Reminders.AddAsync(item); await _context.SaveChangesAsync(); return(newReminder.Entity); }
public async Task <Author> AddAsync(Author item) { var newAuthor = await _context.Authors.AddAsync(item); await _context.SaveChangesAsync(); return(newAuthor.Entity); }
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)); }