Exemple #1
0
        /// <summary>
        /// Reminders the note.
        /// </summary>
        /// <param name="noteId">The note identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="reminder">The reminder.</param>
        /// <returns></returns>
        public async Task <bool> ReminderNote(int noteId, int userId, AddReminderRequest reminder)
        {
            try
            {
                SqlConnection connection = DBConnection();
                SqlCommand    command    = StoreProcedureConnection("spReminder", connection);
                connection.Open();
                command.Parameters.AddWithValue("@UserId", userId);
                command.Parameters.AddWithValue("@Id", noteId);
                command.Parameters.AddWithValue("@AddReminder", reminder.Reminder.ToLocalTime());
                command.Parameters.AddWithValue("@ModifiedDateTime", DateTime.Now);
                int result = await command.ExecuteNonQueryAsync();

                connection.Close();
                if (result != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                };
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #2
0
        public async Task <IActionResult> ReminderNote(int noteId, AddReminderRequest reminder)
        {
            var userId = TokenUserId();

            if (await note.ReminderNote(noteId, userId, reminder))
            {
                string status = "reminder set successfully";
                return(Ok(new { status, userId, noteId, reminder }));
            }
            else
            {
                string status = "reminder is not set";
                return(BadRequest(new { status, userId, noteId, reminder }));
            }
        }
 public static void AddReminder(object sender, AddReminderEventArgs ea)
 {
     AddReminderRequest?.Invoke(sender, ea);
 }
Exemple #4
0
 /// <summary>
 /// Reminders the note.
 /// </summary>
 /// <param name="noteId">The note identifier.</param>
 /// <param name="userId">The user identifier.</param>
 /// <param name="reminder">The reminder.</param>
 /// <returns></returns>
 public async Task <bool> ReminderNote(int noteId, int userId, AddReminderRequest reminder)
 {
     return(await notes.ReminderNote(noteId, userId, reminder));
 }