public async Task <IActionResult> Delete(int noteId, CancellationToken cancellationToken) { var note = await _notesService.GetNoteByIdAsync(noteId); if (note.DepartmentId != DepartmentId) { Unauthorized(); } await _notesService.DeleteAsync(note, cancellationToken); return(RedirectToAction("Index", "Notes", new { Area = "User" })); }
public async Task <IActionResult> Delete(int id) { await _service.DeleteAsync(id); return(Ok()); }