public async Task <IActionResult> PutEtunnel(short id, Etunnel etunnel) { if (id != etunnel.EtunnelId) { return(BadRequest()); } _context.Entry(etunnel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EtunnelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Etunnel> > PostEtunnel(Etunnel etunnel) { _context.Etunnel.Add(etunnel); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EtunnelExists(etunnel.EtunnelId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEtunnel", new { id = etunnel.EtunnelId }, etunnel)); }