// GET: AddAsset public ActionResult AddAsset() { return(View(new AddAssetViewModel { AssetModels = db.AssetModelDropdown(), Rooms = db.RoomDropdown(), })); }
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, }); } }
public SearchViewModel() { SelectedAssetModelId = -1; AssetModels = db.AssetModelDropdown(); }