Пример #1
0
        public async Task <IActionResult> Create([Bind("IdOrder,CustomerName,ProductNameID,EmployeeID,NumberOfProducts,Price,OrderDate,CheckSaleDate")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"]    = new SelectList(_context.Employees, "IdEmployee", "FullName", order.EmployeeID);
            ViewData["ProductNameID"] = new SelectList(_context.Products, "IdProduct", "ProductName", order.ProductNameID);
            _cachedService.RefreshOrders();
            return(View(order));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("IdProduct,ProductName,MaterialNameId,NumberOfMaterialsPerItem,ProductPrice")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaterialNameId"] = new SelectList(_context.Materials, "IdMaterial", "MaterialName", product.MaterialNameId);
            _cachedService.RefreshOrders();
            return(View(product));
        }