Esempio n. 1
0
        private void Create(AssetInput assetInput)
        {
            var assetEntity = ObjectMapper.Map <Asset>(assetInput);

            SetAuditInsert(assetEntity);
            assetRepository.Insert(assetEntity);
            CurrentUnitOfWork.SaveChanges();
        }
Esempio n. 2
0
        public async Task <AssetDto> CreateAsset(AssetInput assetInput)
        {
            Asset entity = ObjectMapper.Map <Asset>(assetInput);

            entity = await assetRepository.InsertAsync(entity);

            return(ObjectMapper.Map <AssetDto>(entity));
        }
Esempio n. 3
0
        public AssetDto CreateAsset(AssetInput input)
        {
            Asset asset = ObjectMapper.Map <Asset>(input);

            SetAuditInsert(asset);
            asset = assetRepository.Insert(asset);
            CurrentUnitOfWork.SaveChanges();
            return(ObjectMapper.Map <AssetDto>(asset));
        }
Esempio n. 4
0
 public void CreateOrEditAsset(AssetInput assetInput)
 {
     if (assetInput.Id == 0)
     {
         Create(assetInput);
     }
     else
     {
         Update(assetInput);
     }
 }
Esempio n. 5
0
        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);
        }
Esempio n. 7
0
        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));
            }
        }
Esempio n. 8
0
 public void CreateOrEditAsset([FromBody] AssetInput input)
 {
     assetAppService.CreateOrEditAsset(input);
 }
Esempio n. 9
0
 public AssetDto UpdateAsset([FromBody] AssetInput input) => appService.UpdateAsset(input);
Esempio n. 10
0
 public AssetDto CreateAsset([FromBody] AssetInput input) => appService.CreateAsset(input);