// ---------------- Constructor ---------------- public AssetTypeInfoModel(DatabaseQueryMultiResult <IList <AssetTypeInfo> > queryResult, IAssetManagerApi api) { this.Api = api; List <AssetTypeInfo> infoList = new List <AssetTypeInfo>(); List <string> errorList = new List <string>(); foreach (DatabaseQueryResult <IList <AssetTypeInfo> > info in queryResult.Results.Values) { if (info.Success) { foreach (AssetTypeInfo assetTypeInfo in info.Result) { infoList.Add(assetTypeInfo); } } else { errorList.Add(api.DataBase.DatabaseNames[info.DatabaseId] + ": " + info.Error.Message); } } this.AssetTypeInfo = infoList.AsReadOnly(); this.Errors = errorList.AsReadOnly(); }
// ---------------- Functions ---------------- public IActionResult Index() { IActionResult action() { DatabaseQueryMultiResult <IList <AssetTypeInfo> > result = this.Api.DataBase.GetAssetTypeInfo(); return(View(new AssetTypeInfoModel(result, this.Api))); }; return(this.SafePerformAction(action)); }