public async Task AddNote(string note) { Note newNote = NotesService.Add(note); // All connected clients will receive this call await Clients.All.BroadcastNewNote(newNote); }
public IHttpActionResult Post([FromBody] ITS_Notes notes) { try { return(Util.Response(new NotesDTO(service.Add(notes)), HttpStatusCode.InternalServerError, string.Format("Could not create invoice notes {0}.", notes.SupplierInvoiceID), Request.RequestUri.AbsoluteUri)); } catch (Exception e) { return(ExceptionMSG(e)); } }
// POST: api/Notes public HttpResponseMessage Post([FromBody] Note note) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } Note newNote = NotesService.Add(note.Text); // All connected clients will receive this call NotesHub.GetConnectedHub().Clients.All.BroadcastNewNote(newNote); // response back return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <ActionResult <NoteModel> > Add(NoteCreationModel model) { return(await _notesService.Add(model)); }
public void ShouldAddANewNote() { service.Add("titolo", "descrizione"); respository.Verify(repo => repo.Insert(It.IsAny <Note>())); }
public void ShouldAddANewNote() { service.Add("titolo", "descrizione"); Assert.That(repository.notes, Has.Count.EqualTo(1)); }