public async Task <ActionResult <HiRailAssetType> > PostHiRailAssetType(HiRailAssetType hiRailAssetType) { _context.HiRailAssetTypes.Add(hiRailAssetType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHiRailAssetType", new { id = hiRailAssetType.Id }, hiRailAssetType)); }
public async Task <IActionResult> PutHiRailAssetType(Guid id, HiRailAssetType hiRailAssetType) { if (id != hiRailAssetType.Id) { return(BadRequest()); } _context.Entry(hiRailAssetType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HiRailAssetTypeExists(id)) { return(NotFound()); } else { return(StatusCode(StatusCodes.Status500InternalServerError)); } } return(NoContent()); }