Пример #1
0
        public async Task <IActionResult> PutEtunnels(long id, Etunnels etunnels)
        {
            if (id != etunnels.EtunnelsId)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EtunnelsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <Etunnels> > PostEtunnels(Etunnels etunnels)
        {
            _context.Etunnels.Add(etunnels);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EtunnelsExists(etunnels.EtunnelsId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEtunnels", new { id = etunnels.EtunnelsId }, etunnels));
        }