Пример #1
0
        public async Task <IActionResult> Create([Bind("CustomerID,Name,Adress,BirthDate")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("ID,Brand_Name,Processor,Price")] Laptop laptop)
        {
            if (ModelState.IsValid)
            {
                _context.Add(laptop);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(laptop));
        }
        public async Task <IActionResult> Create([Bind("ID,CustomerID,Total,NumarFactura")] Bill bill)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bill);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", bill.CustomerID);
            return(View(bill));
        }
        public async Task <IActionResult> Create([Bind("OrderID,CustomerID,LaptopID,OrderDate")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", order.CustomerID);
            ViewData["LaptopID"]   = new SelectList(_context.Laptops, "ID", "ID", order.LaptopID);
            return(View(order));
        }