Ejemplo n.º 1
0
        public ActionResult Create(ReminderItemModel reminderItem)
        {
            _reminderRepository.CreateReminder(reminderItem);
            var reminderId = _reminderRepository.GetReminderId(reminderItem);

            _userReminderRelationsRepository.CreateRelation(User.Identity.GetUserId(), reminderId);
            return(RedirectToAction("MyReminders", "Home"));
        }
Ejemplo n.º 2
0
        public Task <bool> CreateReminder(string userId, string email, ReminderSchedule schedule)
        {
            var reminders = _reminderRepository.IsReminderExists(userId, schedule.NewsId).Result;

            if (reminders)
            {
                throw new ReminderAlreadyExistsException($"This News already have a reminder");
            }
            _reminderRepository.CreateReminder(userId, email, schedule);
            return(Task.FromResult(true));
        }
Ejemplo n.º 3
0
        //This method should be used to save a new reminder.
        public Reminder CreateReminder(Reminder reminder)
        {
            Reminder r = reminderRepo.GetReminderById(reminder.Id);

            if (r == null)
            {
                return(reminderRepo.CreateReminder(reminder));
            }
            else
            {
                throw new ReminderNotCreatedException("This reminder already exists");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method for creating reminder
        /// </summary>
        /// <param name="userId">The user id against whom the reminder is to be added</param>
        /// <param name="email">The email of the user</param>
        /// <param name="schedule">The reminder details</param>
        /// <returns>True if creation successful</returns>
        public async Task <bool> CreateReminder(string userId, string email, ReminderSchedule schedule)
        {
            if (!await reminderRepository.IsReminderExists(userId, schedule.NewsId))
            {
                await reminderRepository.CreateReminder(userId, email, schedule);

                return(true);
            }
            else
            {
                throw new ReminderAlreadyExistsException($"This News already have a reminder");
            }
        }
        //This method should be used to save a new reminder.
        public Reminder CreateReminder(Reminder reminder)
        {
            var reminders = repository.CreateReminder(reminder);

            if (reminders != null)
            {
                return(reminder);
            }
            else
            {
                throw new ReminderNotCreatedException($"This reminder already exists");
            }
        }
Ejemplo n.º 6
0
        public Reminder CreateReminder(Reminder reminder)
        {
            //check if reminder is already exist
            var result = _reminderRepository.GetReminderByName(reminder.Name);

            if (result != null)
            {
                throw new ReminderNotCreatedException("Reminder with same name is already exists");
            }

            result = _reminderRepository.CreateReminder(reminder);

            if (result == null)
            {
                throw new ReminderNotCreatedException("This reminder id already exists");
            }
            return(result);
        }
Ejemplo n.º 7
0
        public Reminder CreateReminder(Reminder reminder)
        {
            try
            {
                var result = reminderRepository.CreateReminder(reminder);
                if (result == null)
                {
                    throw new ReminderNotCreatedException("This reminder already exists");
                }

                return(result);
            }
            catch (ReminderNotCreatedException)
            {
                throw;
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 8
0
 //This method should be used to save a new reminder.
 public Reminder CreateReminder(Reminder reminder)
 {
     return(reminderRepo.CreateReminder(reminder));
 }
 public void CreateReminder(Reminder reminder)
 {
     _reminderRepository.CreateReminder(reminder);
 }