コード例 #1
0
        public async Task AddNote(string note)
        {
            Note newNote = NotesService.Add(note);

            // All connected clients will receive this call
            await Clients.All.BroadcastNewNote(newNote);
        }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
        // 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));
        }
コード例 #4
0
 public async Task <ActionResult <NoteModel> > Add(NoteCreationModel model)
 {
     return(await _notesService.Add(model));
 }
コード例 #5
0
        public void ShouldAddANewNote()
        {
            service.Add("titolo", "descrizione");

            respository.Verify(repo => repo.Insert(It.IsAny <Note>()));
        }
コード例 #6
0
        public void ShouldAddANewNote()
        {
            service.Add("titolo", "descrizione");

            Assert.That(repository.notes, Has.Count.EqualTo(1));
        }