コード例 #1
0
        public async Task <IActionResult> Putpcm_payment(long id, pcm_payment pcm_payment)
        {
            if (id != pcm_payment.id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!pcm_paymentExists(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_payment> > Postpcm_payment(pcm_payment pcm_payment)
        {
            _context.pcm_payment.Add(pcm_payment);
            await _context.SaveChangesAsync();

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

            return(CreatedAtAction("Getpcm_payment", new { id = pcm_payment.id }, pcm_payment));
        }