Esempio n. 1
0
        public async Task <bool> UpdateProduct(DomainProduct product)
        {
            var entityProduct = Projections.DomainProductToEntityProduct(product);

            UpdateSlug(entityProduct);

            _ctx.Products.Update(entityProduct);

            return((await _ctx.SaveChangesAsync()) > 0);
        }
Esempio n. 2
0
        public async Task <int> CreateProduct(DomainProduct product)
        {
            var entityProduct = Projections.DomainProductToEntityProduct(product);

            UpdateSlug(entityProduct);

            _ctx.Products.Add(entityProduct);

            await _ctx.SaveChangesAsync();

            return(entityProduct.Id);
        }