Пример #1
0
        public Task <bool> AddOrUpdateReminder(string userId, int newsId, Reminder reminder)
        {
            var reminderExists = _newsRepository.GetNewsById(userId, newsId).Result;

            if (reminderExists == null)
            {
                throw new NoNewsFoundException($"NewsId {newsId} for {userId} doesn't exist");
            }
            return(_newsRepository.AddOrUpdateReminder(userId, newsId, reminder));
        }
Пример #2
0
 /// <summary>
 /// Method for adding or updating a reminder of a news
 /// </summary>
 /// <param name="userId">The id of the user of the news</param>
 /// <param name="newsId">The id of the news to whom reminder is to be added or updated</param>
 /// <param name="reminder">The object with new values for reminder</param>
 /// <returns>True if operation success else false</returns>
 public async Task <bool> AddOrUpdateReminder(string userId, int newsId, Reminder reminder)
 {
     if (await newsRepository.GetNewsById(userId, newsId) != null)
     {
         return(await newsRepository.AddOrUpdateReminder(userId, newsId, reminder));
     }
     else
     {
         throw new NoNewsFoundException($"NewsId {newsId} for {userId} doesn't exist");
     }
 }