Example #1
0
        public void FindVend_ReturnsASpecificVendor_Vend()
        {
            string name1    = "Suzie's Cupcakes";
            string name2    = "David's Donut Shop";
            Vend   newVend1 = new Vend(name1);
            Vend   newVend2 = new Vend(name2);

            Vend result = Vend.FindVend(2);

            Assert.AreEqual(newVend2, result);
        }
Example #2
0
        [HttpPost("/vendors/{vendorId}/orders")] //Creates new order within a Vendor
        public ActionResult Create(int vendorId, string OrderInfo, string OrderPrice, string OrderDate)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Vend  foundVend = Vend.FindVend(vendorId);
            Order newOrder  = new Order(OrderInfo, OrderPrice, OrderDate);

            foundVend.AddOrder(newOrder);
            List <Order> allVendOrders = foundVend.Orders;

            model.Add("orders", allVendOrders);
            model.Add("vendor", foundVend);
            return(View("Show", model));
        }
Example #3
0
        [HttpGet("/vendors/{vendorId}/orders/new")] //displays page that has a form to add a new order (to a vendor)
        public ActionResult New(int vendorId)
        {
            Vend vend = Vend.FindVend(vendorId);

            return(View(vend));
        }