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)); }
public async Task <bool> CreateCatalogAsync(CatalogEntity catalogEntity) { await _dataContext.AddAsync(catalogEntity); return(await _dataContext.SaveChangesAsync() > 0); }