public async Task <IActionResult> Putpcm_invoice(long id, pcm_invoice pcm_invoice) { if (id != pcm_invoice.id) { return(BadRequest()); } _context.Entry(pcm_invoice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!pcm_invoiceExists(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 <pcm_invoice> > Postpcm_invoice(pcm_invoice pcm_invoice) { _context.pcm_invoice.Add(pcm_invoice); await _context.SaveChangesAsync(); var lMsg = new ServerUpdateHubMsg(_entity, ServerUpdateHubMsg.TOperation.INSERT, pcm_invoice.id); var lJson = JsonConvert.SerializeObject(lMsg); await _hubContext.Clients.All.SendAsync(lMsg.entity, lJson); return(CreatedAtAction("Getpcm_invoice", new { id = pcm_invoice.id }, pcm_invoice)); }