Пример #1
0
        public async Task <IActionResult> Create([Bind("O_ID,P_Name,Quantity,CAddress")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("P_ID,P_Name,Quantity,Model")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("Name,Phone,address,ID,O_ID")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["O_ID"] = new SelectList(_context.Order, "O_ID", "P_Name", customer.O_ID);
            return(View(customer));
        }