private void Create(AssetInput assetInput) { var assetEntity = ObjectMapper.Map <Asset>(assetInput); SetAuditInsert(assetEntity); assetRepository.Insert(assetEntity); CurrentUnitOfWork.SaveChanges(); }
public async Task <AssetDto> CreateAsset(AssetInput assetInput) { Asset entity = ObjectMapper.Map <Asset>(assetInput); entity = await assetRepository.InsertAsync(entity); return(ObjectMapper.Map <AssetDto>(entity)); }
public AssetDto CreateAsset(AssetInput input) { Asset asset = ObjectMapper.Map <Asset>(input); SetAuditInsert(asset); asset = assetRepository.Insert(asset); CurrentUnitOfWork.SaveChanges(); return(ObjectMapper.Map <AssetDto>(asset)); }
public void CreateOrEditAsset(AssetInput assetInput) { if (assetInput.Id == 0) { Create(assetInput); } else { Update(assetInput); } }
private void Update(AssetInput assetInput) { var assetEntity = assetRepository.GetAll().Where(x => !x.IsDelete).SingleOrDefault(x => x.Id == assetInput.Id); if (assetEntity == null) { } ObjectMapper.Map(assetInput, assetEntity); SetAuditEdit(assetEntity); assetRepository.Update(assetEntity); CurrentUnitOfWork.SaveChanges(); }
public void ElevatedTestPostAssets() { output.WriteLine("This test communicates with the Cheetah API. Elevated permissions are required to test this."); Login login = LoadLogin(); string bearerToken = CheetahHandler.PostLogin(login).Jwt; AssetInput assetInput = new AssetInput(new AssetIdentifier("", "AAPL", "", ""), 12); List <AssetInput> assets = new List <AssetInput> { assetInput }; AccountResponse resp = CheetahHandler.PostAssets(bearerToken, assets).Result; Assert.NotEqual(resp.AccountId, -1); }
public AssetDto UpdateAsset(AssetInput input) { Asset asset = assetRepository .GetAll() .Where(item => !item.IsDelete) .SingleOrDefault(item => item.Id == input.Id); if (asset is null) { return(null); } else { ObjectMapper.Map(input, asset); SetAuditEdit(asset); asset = assetRepository.Update(asset); CurrentUnitOfWork.SaveChanges(); return(ObjectMapper.Map <AssetDto>(asset)); } }
public void CreateOrEditAsset([FromBody] AssetInput input) { assetAppService.CreateOrEditAsset(input); }
public AssetDto UpdateAsset([FromBody] AssetInput input) => appService.UpdateAsset(input);
public AssetDto CreateAsset([FromBody] AssetInput input) => appService.CreateAsset(input);