예제 #1
0
        public async Task <IActionResult> Putpcm_ordersession(long id, pcm_ordersession pcm_ordersession)
        {
            if (id != pcm_ordersession.id)
            {
                return(BadRequest());
            }

            _context.Entry(pcm_ordersession).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!pcm_ordersessionExists(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());
        }
예제 #2
0
        public async Task <ActionResult <pcm_ordersession> > Postpcm_ordersession(pcm_ordersession pcm_ordersession)
        {
            _context.pcm_ordersession.Add(pcm_ordersession);
            await _context.SaveChangesAsync();

            var lMsg  = new ServerUpdateHubMsg(_entity, ServerUpdateHubMsg.TOperation.INSERT, pcm_ordersession.id);
            var lJson = JsonConvert.SerializeObject(lMsg);
            await _hubContext.Clients.All.SendAsync(lMsg.entity, lJson);

            return(CreatedAtAction("Getpcm_ordersession", new { id = pcm_ordersession.id }, pcm_ordersession));
        }