Exemplo n.º 1
0
 // GET: AddAsset
 public ActionResult AddAsset()
 {
     return(View(new AddAssetViewModel
     {
         AssetModels = db.AssetModelDropdown(),
         Rooms = db.RoomDropdown(),
     }));
 }
Exemplo n.º 2
0
        public EditAssetViewModel(int id)
        {
            var asset = db.Assets.Find(id);

            Id                   = asset.Id;
            Name                 = asset.Name;
            SerialNumber         = asset.SerialNumber;
            Value                = asset.Value;
            SelectedAssetModelId = asset.AssetModelId;
            AssetModels          = db.AssetModelDropdown();

            Properties = new List <PropertyEditor>();
            foreach (var p in asset.AssetProperties)
            {
                Properties.Add(new PropertyEditor
                {
                    ModelPropertyId = p.AssetModelPropertyId,
                    Name            = p.AssetModelProperty.Name,
                    IsNumeric       = p.AssetModelProperty.IsNumeric,
                    AssetPropertyId = p.Id,
                    Value           = p.Value,
                });
            }
        }
Exemplo n.º 3
0
 public SearchViewModel()
 {
     SelectedAssetModelId = -1;
     AssetModels          = db.AssetModelDropdown();
 }