Example #1
0
        public async Task <bool> AddCatalog(CatalogDto catalogDto, int userId)
        {
            if (catalogDto == null)
            {
                return(false);
            }

            // Only unique names for catalog
            if (_catalogRepository.IsExistCatalog(catalogDto.CatalogName, userId))
            {
                return(false);
            }

            // new catalog to add with properties from view
            var catalogEntity = new CatalogEntity
            {
                CatalogName = catalogDto.CatalogName,
                UserId      = userId
            };

            return(await _catalogRepository.CreateCatalogAsync(catalogEntity));
        }