示例#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);
        }
 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>()));
        }
        public void ShouldAddANewNote()
        {
            service.Add("titolo", "descrizione");

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