public static async void ClearLocal(INotesService notesService) { var items = notesService.GetAllNotes().Result.ToList(); foreach (var item in items) { await notesService.DeleteNote(item); } }
public ActionResult <bool> DeleteNote(int noteId) { bool result = _notesService.DeleteNote(noteId); if (result == false) { return(BadRequest()); } return(Ok(result)); }
public ActionResult DeleteNote(int id) { try { _service.DeleteNote(id); _service.DeleteDanglingCategories(); } catch { return(BadRequest()); } return(Ok()); }
public async Task <IActionResult> Delete(int id) { try { await _notes.DeleteNote(id); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
protected void rptNotes_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToString() == "Delete") { long NoteID = e.CommandArgument.ConvertToLong(); bool IsPrivate = ((HiddenField)e.Item.FindControl("IsPrivate")).Value.ConvertToBoolean(); m_Notes.DeleteNote(NoteID, NoteType); if (IsPrivate == false) { HistoryString = PhraseLib.Lookup("history.note-delete", LanguageID); ActivityTypePhraseID = m_ActivityLog.GetActivityTypePhraseID(ActivityType); if (ActivityTypePhraseID > 0) { HistoryString += " " + PhraseLib.Lookup("term.from", LanguageID).ToLower() + " " + PhraseLib.Lookup(ActivityTypePhraseID, LanguageID).ToLower(); } if (LinkID == 0) { switch (NoteType) { case NoteTypes.Offers: case NoteTypes.CustomerGroup: case NoteTypes.ProductGroup: case NoteTypes.PointsProgram: case NoteTypes.StoredValueProgram: case NoteTypes.Promovar: case NoteTypes.Graphic: case NoteTypes.Layout: case NoteTypes.Store: case NoteTypes.StoreGroup: case NoteTypes.Agent: case NoteTypes.Report: case NoteTypes.User: case NoteTypes.Banner: case NoteTypes.Department: case NoteTypes.Terminal: HistoryString += " " + PhraseLib.Lookup("term.list", LanguageID).ToLower(); break; } } m_ActivityLog.Activity_Log(ActivityType, LinkID, AdminUserID, HistoryString); } if (NotesUpdate != null) { NotesUpdate(source, e); } LoadNotes(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "toggleNotesDisplay()", true); } }
public async Task <JsonResult> DeleteAjax(int id) { try { var noteToBeDeleted = await _notesService.GetNoteById(id); await _notesService.DeleteNote(noteToBeDeleted); return(BuildResponse(new { Message = "Eliminado correctamente" })); } catch { return(BuildResponse(new { Message = $"Algo paso y no se pudo eliminar la nota con id: {id}" }, false)); } }
public async Task <IActionResult> DeleteNote( [FromQuery(Name = "Id")] int Id, [FromQuery(Name = "Title")] string Title, [FromQuery(Name = "Message")] string Message, [FromQuery(Name = "Pinned")] string Pinned, [FromQuery(Name = "Label")] string Label) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } List <Note> note = await _NoteServices.DeleteNote(Id, Title, Message, Pinned, Label); if (note.Count == 0) { return(NotFound()); } return(NoContent()); }
public async Task <IActionResult> DeleteNoteAsync(int noteId) { int userId = Convert.ToInt32(HttpContext.Items["userId"]); var result = await _service.DeleteNote(noteId, userId); if (result == null) { return(BadRequest(new { Data = result, StatusCode = (int)HttpStatusCode.BadRequest, Message = ResponseMessages.DELETED })); } return(Ok(new { Data = result, StatusCode = (int)HttpStatusCode.OK, Message = ResponseMessages.DELETED })); }
public bool DeleteNote(Guid guid) { return(_service.DeleteNote(guid)); }
public void Delete(int noteId) { _notesService.DeleteNote(noteId); }
public async Task <IActionResult> DeleteFolders(int id) => Ok(await _notesService.DeleteNote(id));