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