public CreateUpdateNoteResponse UpdateNote([FromBody] UpdateNoteAction updateNote) { CreateUpdateNoteResponse response = new CreateUpdateNoteResponse(); response.Status = string.Empty; if (string.IsNullOrEmpty(updateNote.Email)) { return(response); } using (RequestTracker request = new RequestTracker(Constant.RequestAPI.UpdateNote.ToString(), updateNote.Email)) { try { if (string.IsNullOrEmpty(updateNote.Email) || string.IsNullOrEmpty(updateNote.AuthToken) || string.IsNullOrEmpty(updateNote.NoteContents) || string.IsNullOrEmpty(updateNote.RowKey)) { request.response = RequestTracker.RequestResponse.UserError; return(response); } if (updateNote.NoteContents.Length > Constant.MaxNoteLength) { request.response = RequestTracker.RequestResponse.UserError; response.Status = "TooLong"; return(response); } // Use the email and authToken to get the userId string userId = UserController.GetUserId(updateNote.Email, updateNote.AuthToken); if (string.IsNullOrEmpty(userId)) { request.response = RequestTracker.RequestResponse.UserError; // Expired AuthToken response.Status = "Expired"; return(response); } response.Note = NoteModel.UpdateNote(userId, updateNote.RowKey, updateNote.NoteContents, updateNote.City, updateNote.Latitude, updateNote.Longitude, updateNote.Completed); if (response.Note == null) { request.response = RequestTracker.RequestResponse.UserError; // Expired AuthToken response.Status = "Invalid"; return(response); } LastUpdateModel.SetLastUpdate(userId); response.Status = "Success"; return(response); } catch (Exception e) { request.response = RequestTracker.RequestResponse.ServerError; ExceptionTracker.LogException(e); return(response); } } }
public bool UpdateNote(int _ID_NOTE, NoteObject noteObj) { return(noteModel.UpdateNote(_ID_NOTE, noteObj)); }