Ejemplo n.º 1
0
        public ActionResult Insert(Everything e)
        {
            int  everything   = w.CheckEverythingFilledIn(e);
            bool custFilledIn = w.CheckCustomerFilledIn(e.Customer);
            bool prodFilledIn = w.CheckProductFilledIn(e.Product);

            if (custFilledIn && prodFilledIn)
            {
                SetVB("Not Needed", "Product and Customer cannot be added at the same time");
                return(View("Index"));
            }

            if (custFilledIn)
            {
                w.AddCustomer(e.Customer);
            }

            if (prodFilledIn)
            {
                w.AddProduct(e.Product);
            }

            if (w.CheckOrderFilledIn(e.Order))
            {
                w.AddOrder(e.Order);
            }

            if (w.CheckCartFilledIn(e.Cart))
            {
                w.AddCart(e.Cart);
            }

            SetVB("Not Needed", "Insert(s) successful");
            return(View("Index"));
        }