public async Task <IActionResult> PutTinfrastructure(short id, Tinfrastructure tinfrastructure) { if (id != tinfrastructure.TinfrastructureId) { return(BadRequest()); } _context.Entry(tinfrastructure).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TinfrastructureExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tinfrastructure> > PostTinfrastructure(Tinfrastructure tinfrastructure) { _context.Tinfrastructure.Add(tinfrastructure); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TinfrastructureExists(tinfrastructure.TinfrastructureId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTinfrastructure", new { id = tinfrastructure.TinfrastructureId }, tinfrastructure)); }