Esempio n. 1
0
 /// <summary>
 /// Gets the asset by name.
 /// </summary>
 /// <param name="id">The asset name.</param>
 public AssetViewModel GetAssetByName(string assetName, bool includeTags = false)
 {
     try
     {
         Asset asset = AssetManager.GetAssetByName(assetName);
         return(AssetViewModelFactory.CreateFromDomainModel(asset, ObjectMapper));
     }
     catch (Exception ex)
     {
         ExceptionManager.HandleException(ex, PolicyNameType.ExceptionReplacing);
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the asset by id.
        /// </summary>
        /// <param name="id">The id.</param>
        ///

        /// <summary>
        /// Gets the asset by id.
        /// </summary>
        /// <param name="id">The id.</param>
        public AssetViewModel GetAssetById(int id, bool includeTags = false)
        {
            try
            {
                Asset asset = includeTags ? AssetManager.FindWithTagsBy(id) : AssetManager.FindBy(id);
                return(AssetViewModelFactory.CreateFromDomainModel(asset, ObjectMapper));
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ex, PolicyNameType.ExceptionReplacing);
            }
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the document assets by company.
        /// </summary>
        /// <param name="companyId">The company id.</param>
        /// <returns></returns>
        public List <AssetViewModel> GetDocumentAssetsByCompany(int companyId)
        {
            List <AssetViewModel> models = new List <AssetViewModel>();

            try
            {
                List <Asset> assets = AssetManager.GetDocumentAssetsByCompany(companyId);
                models = AssetViewModelFactory.CreateFromDomainModel(assets, ObjectMapper);
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ex, PolicyNameType.ExceptionReplacing);
            }
            return(models);
        }