Beispiel #1
0
        public int CreateProduct(BusinessEntities.Productos productEntity)
        {
            using (var scope = new TransactionScope())
            {
                _unitOfWork.ProductoRepository.Insert(productEntity);
                _unitOfWork.Save();
                scope.Complete();

                return(productEntity.IdProducto);
            }
        }
Beispiel #2
0
        public bool UpdateProduct(int productId, BusinessEntities.Productos productEntity)
        {
            var success = false;

            if (productEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var product = _unitOfWork.ProductoRepository.GetById(productId);
                    if (product != null)
                    {
                        _unitOfWork.ProductoRepository.Update(product);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }

            return(success);
        }