Example #1
0
 private void AddAssetViewModel(AssetListViewModel viewModel, Asset asset)
 {
     var assetViewModel = new AssetViewModel(){Asset = asset};
     foreach (var property in viewModel.Properties)
     {
         assetViewModel.SetPropertyValue(property, asset.GetPropertyValue(property.FullName));
     }
     viewModel.AddAsset(assetViewModel);
 }
Example #2
0
 public ActionResult Create(string assetType, FormCollection values)
 {
     var viewModel = CreateAssetListViewModel(assetType, false);
     var asset = new Asset(viewModel.AssetType);
     foreach (var property in viewModel.Properties)
     {
         asset.GetPropertyValue(property.FullName).SystemValue = values[property.FullName];
     }
     AssetService.AddAsset(asset);
     return RedirectToAction("Index", new{assetType});
 }
        public AssetPropertyValue(Asset asset, AssetProperty property)
        {
            Asset = asset;
            Property = property;

            if (property.Type != null)
            {
                if (property.IsCollection)
                {
                    AssetValues = new List<Asset>();
                }
                else
                {
                    AssetValue = new Asset(property.Type);
                }
            }
        }
Example #4
0
 public void RemoveAsset(Asset asset)
 {
     AssetRepository.Remove(asset);
 }
Example #5
0
 public void AddAsset(Asset asset)
 {
     AssetRepository.Add(asset);
 }