/// <summary> /// Initializes a new instance of the <see cref="AssetAppService"/> class. /// </summary> /// <param name="AssetManager">The asset manager.</param> /// <param name="VideoManager">The video manager.</param> /// <param name="objectMapper">The object mapper.</param> /// <param name="cacheService">The cache service.</param> /// <param name="exceptionManager">The exception manager.</param> /// <param name="loggingService">The logging service.</param> public AssetAppService( IAssetDomainService assetManager, IUnitDomainService unitManager, IVideoDomainService videoManager, IObjectMapperAdapter objectMapper, ICacheAdapter cacheService, IFileManagerAdapter fileManager, IExceptionManagerAdapter exceptionManager, ILoggingServiceAdapter loggingService) : base(objectMapper, cacheService, exceptionManager, loggingService) { this.AssetManager = assetManager; this.UnitManager = unitManager; this.VideoManager = videoManager; this.FileManager = fileManager; }
/// <summary> /// Creates the asset view model from create asset view model. /// </summary> /// <param name="createAssetViewModel">The create asset view model.</param> /// <param name="uploadPath">The upload path.</param> /// <param name="companyId">The company id.</param> /// <param name="fileManagerAdapter">The file manager adapter.</param> /// <returns></returns> public static AssetViewModel CreateAssetViewModelFromCreateAssetViewModel(CreateAssetViewModel createAssetViewModel, string uploadPath, int companyId, IFileManagerAdapter fileManagerAdapter) { AssetViewModel assetViewModel = CreateAssetViewModelFromCreateAssetViewModel(createAssetViewModel); if (assetViewModel != null) { bool isWebUrl = !string.IsNullOrEmpty(createAssetViewModel.Path) ? true : false; assetViewModel.AssetType = createAssetViewModel.AssetType; assetViewModel.Name = createAssetViewModel.Name; assetViewModel.CompanyId = companyId; assetViewModel.Path = isWebUrl ? createAssetViewModel.Path : fileManagerAdapter.Save(createAssetViewModel.UploadFile, uploadPath); assetViewModel.ContentType = fileManagerAdapter.GetContentType(createAssetViewModel.UploadFile); if (assetViewModel is VideoViewModel) { ((VideoViewModel)assetViewModel).AlternatePath = fileManagerAdapter.Save(createAssetViewModel.AlternateUploadFile, uploadPath); ((VideoViewModel)assetViewModel).AlternateContentType = fileManagerAdapter.GetContentType(createAssetViewModel.AlternateUploadFile); } } return(assetViewModel); }