public async Task <IActionResult> Putdoc_document(long id, doc_document doc_document) { if (id != doc_document.id) { return(BadRequest()); } _context.Entry(doc_document).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!doc_documentExists(id)) { return(NotFound()); } else { throw; } } var lMsg = new ServerUpdateHubMsg(_entity, ServerUpdateHubMsg.TOperation.UPDATE, id); var lJson = JsonConvert.SerializeObject(lMsg); await _hubContext.Clients.All.SendAsync(lMsg.entity, lJson); return(NoContent()); }
public async Task <ActionResult <doc_document> > Postdoc_document(doc_document doc_document) { _context.doc_document.Add(doc_document); await _context.SaveChangesAsync(); var lMsg = new ServerUpdateHubMsg(_entity, ServerUpdateHubMsg.TOperation.INSERT, doc_document.id); var lJson = JsonConvert.SerializeObject(lMsg); await _hubContext.Clients.All.SendAsync(lMsg.entity, lJson); return(CreatedAtAction("Getdoc_document", new { id = doc_document.id }, doc_document)); }