Beispiel #1
0
        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();
        }
Beispiel #2
0
        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)));
        }