示例#1
0
        public void Execute(CreateProductDto request)
        {
            try
            {
                var query = Context.Products
                            .Where(p => p.product_id == request.Id)
                            .FirstOrDefault();

                query.category_id = request.CategoryId;
                query.description = request.Description;
                query.name        = request.Name;
                query.price       = request.Price;


                DeleteManufacturers.RemoveExistingProductManufacturers(request);
                DeleteSuppliers.RemoveExistingProductSuppliers(request);
                Context.SaveChanges();

                Manufacturers.Execute(request, (int)request.Id);
                Suppliers.Execute(request, (int)request.Id);
                Context.SaveChanges();
            }
            catch (CustomException e)
            {
                throw new CustomException("Doslo je do greske prilikom konekcije!");
            }
        }
示例#2
0
        public void Execute(CreateProductDto request)
        {
            Product product = CreateNewProduct(request);

            var productId = product.product_id;

            Manufacturers.Execute(request, productId);
            Suppliers.Execute(request, productId);
            Context.SaveChanges();
        }