Exemplo n.º 1
0
        public async Task <ApiResponse <AssetDto> > Post([FromBody] AssetDto value)
        {
            value.Id = null; // Make sure that this is a insert operation.
            AssetDto asset = await _assetService.AddUpdateAsset(UserId, value).ConfigureAwait(false);

            return(new ApiResponse <AssetDto>
            {
                Data = asset
            });
        }
Exemplo n.º 2
0
        public async Task AddAsset()
        {
            User       testUser  = AddTestUser();
            Asset      testAsset = AddTestAsset(testUser);
            FileStream fs        = new FileStream(@"..\..\Data\TestImage.png", FileMode.Open);

            _testAsset = await _assetSvc.AddUpdateAsset(testUser.Id, new AssetDto
            {
                Name        = "Test Asset",
                Description = "Test Asset",
                UserId      = testUser.Id
            }).ConfigureAwait(false);

            // Need to do this because the mock isn't complete
            _mockUow.AssetDb[_testAsset.Id.Value].User = testUser;

            _testAsset = await _assetSvc.UpdateAssetImage(fs, testUser.Id, _testAsset.Id.Value, "image/png").ConfigureAwait(false);
        }