public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,Address,Zipcode,PhoneNumber,Extension")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Zipcode"] = new SelectList(_context.Zips, "Zipcode", "Zipcode", customer.Zipcode);
            return(View(customer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("OrdersId,CustomerId,OrderDate,FreightCharge,TotalDue")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "FirstName", orders.CustomerId);
            return(View(orders));
        }
        public async Task <IActionResult> Create([Bind("CustomerId,PmtDate,Amt")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "FirstName", payment.CustomerId);
            return(View(payment));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("OrdersId,ProductsId,Quantity,UnitPrice,LineItemTotal,ShipDate")] ItemsonOrder itemsonOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(itemsonOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrdersId"]   = new SelectList(_context.Orders, "OrdersId", "OrdersId", itemsonOrder.OrdersId);
            ViewData["ProductsId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", itemsonOrder.ProductsId);
            return(View(itemsonOrder));
        }