Beispiel #1
0
        public async Task <IActionResult> Putpcm_customer(long id, pcm_customer pcm_customer)
        {
            if (id != pcm_customer.id)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!pcm_customerExists(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());
        }
Beispiel #2
0
        public async Task <ActionResult <pcm_customer> > Postpcm_customer(pcm_customer pcm_customer)
        {
            _context.pcm_customer.Add(pcm_customer);
            await _context.SaveChangesAsync();

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

            return(CreatedAtAction("Getpcm_customer", new { id = pcm_customer.id }, pcm_customer));
        }