public async Task <IActionResult> AddNote([FromBody] NoteInsertModel model) { try { if (!ModelState.IsValid) { throw new Exception("Model not valid."); } return(Ok(await _noteService.Add(model, GetUserId()))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <bool> Handle(Request request, CancellationToken cancellationToken) { bool result = false; try { result = await Task.FromResult(noteModule.Add(request.Text)); } catch (Exception ex) { throw ex; } return(result); }