Ejemplo n.º 1
0
        public Order CreateOrder(Order order)
        {
            if (order == null)
            {
                throw new ArgumentNullException(nameof(order));
            }

            if (order.Id != default(long))
            {
                throw new ArgumentOutOfRangeException(nameof(order.Id));
            }

            _context.Orders.Add(order);
            _context.SaveChanges();

            return(order);
        }
Ejemplo n.º 2
0
        public Supplier CreateSupplier(Supplier supplier)
        {
            if (supplier == null)
            {
                throw new ArgumentNullException(nameof(supplier));
            }

            if (supplier.Id != default(long))
            {
                throw new ArgumentOutOfRangeException(nameof(supplier.Id));
            }

            _context.Suppliers.Add(supplier);
            _context.SaveChanges();

            return(supplier);
        }
Ejemplo n.º 3
0
        public Product CreateProduct(Product product)
        {
            if (product == null)
            {
                throw new ArgumentNullException(nameof(product));
            }

            if (product.Id != default(long))
            {
                throw new ArgumentOutOfRangeException(nameof(product.Id));
            }

            _context.Products.Add(product);
            _context.SaveChanges();

            return(product);
        }
Ejemplo n.º 4
0
        public Customer CreateCustomer(Customer customer)
        {
            if (customer == null)
            {
                throw new ArgumentNullException(nameof(customer));
            }

            if (customer.Id != default(long))
            {
                throw new ArgumentOutOfRangeException(nameof(customer.Id));
            }

            _context.Customers.Add(customer);
            _context.SaveChanges();

            return(customer);
        }