public Asset([NotNull] Data.Models.Asset other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } Id = other.Id; Name = other.Name; Version = other.Version; Locations = other.Locations?.Select(al => new AssetLocation(al)).ToList(); }
public async Task <IActionResult> GetAsset(int id) { Data.Models.Asset asset = await _context.Assets.Where(a => a.Id == id) .Include(a => a.Locations) .FirstOrDefaultAsync(); if (asset == null) { return(NotFound()); } return(Ok(new Asset(asset))); }