예제 #1
0
        public async Task <int> AddOrUpdate(Reminder reminder)
        {
            reminder.AlreadyNotified = 0;

            // UI Form forces user to a limit value for reminder title and comment
            // We substring values if he has been able to overpass it (by hacking, in some way)
            int titleMaxLength = 50, commentMaxLength = 500;

            if (!string.IsNullOrEmpty(reminder.Title) && reminder.Title.Length > titleMaxLength)
            {
                reminder.Title = reminder.Title.Substring(0, titleMaxLength);
            }

            if (!string.IsNullOrEmpty(reminder.Comment) && reminder.Comment.Length > commentMaxLength)
            {
                reminder.Comment = reminder.Comment.Substring(0, commentMaxLength);
            }

            return(await _reminderRepository.AddOrUpdate(reminder));
        }