// 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)); }
// DELETE: api/Notes public HttpResponseMessage Delete(int noteId) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } if (NotesService.Remove(noteId)) { // All connected clients will receive this call NotesHub.GetConnectedHub().Clients.All.BroadcastRemoveNote(noteId); } // response back return(Request.CreateResponse(HttpStatusCode.OK)); }
public FrontServiceClient() { UserHub = new UserHub(); NotesHub = new NotesHub(); AuthenticationHub = new AuthenticationHub(); }