Esempio n. 1
0
 public string DeleteNote([FromBody] DeleteNoteAction deleteNote)
 {
     if (string.IsNullOrEmpty(deleteNote.Email))
     {
         return(string.Empty);
     }
     using (RequestTracker request = new RequestTracker(Constant.RequestAPI.DeleteNote.ToString(), deleteNote.Email))
     {
         try
         {
             if (string.IsNullOrEmpty(deleteNote.Email) ||
                 string.IsNullOrEmpty(deleteNote.AuthToken) ||
                 string.IsNullOrEmpty(deleteNote.RowKey))
             {
                 request.response = RequestTracker.RequestResponse.UserError;
                 return(string.Empty);
             }
             // Use the email and authToken to get the userId
             string userId = UserController.GetUserId(deleteNote.Email, deleteNote.AuthToken);
             if (string.IsNullOrEmpty(userId))
             {
                 request.response = RequestTracker.RequestResponse.UserError;
                 // Expired AuthToken
                 return("Expired");
             }
             if (!NoteModel.DeleteNote(userId, deleteNote.RowKey))
             {
                 return("Invalid");
             }
             LastUpdateModel.SetLastUpdate(userId);
             return("Success");
         }
         catch (Exception e)
         {
             request.response = RequestTracker.RequestResponse.ServerError;
             ExceptionTracker.LogException(e);
             return(string.Empty);
         }
     }
 }
 public bool DeleteNote(int _ID_USER, int _ID_NOTE)
 {
     return(noteModel.DeleteNote(_ID_USER, _ID_NOTE));
 }