public async Task <IActionResult> PutTgangway(long id, Tgangway tgangway) { if (id != tgangway.TgangwayId) { return(BadRequest()); } _context.Entry(tgangway).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TgangwayExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tgangway> > PostTgangway(Tgangway tgangway) { _context.Tgangway.Add(tgangway); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TgangwayExists(tgangway.TgangwayId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTgangway", new { id = tgangway.TgangwayId }, tgangway)); }