Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("OrderID,CartID,CustomerID,ProductID,Price,Quantity")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
        public async Task <IActionResult> Create([Bind("ProductID,ProductName,Description,Price,Quantity")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("CustomerID,CustomerName,Email,MobileNO,Address")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("AdminID,AdminName,Email,MobileNO,Password")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
        public async Task <IActionResult> Create([Bind("PaymentID,OrderedID,Paymentmethod,Price")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(payment));
        }
Exemplo n.º 6
0
 public bool Cadastrar(Estoque estoque)
 {
     if (!Exists(estoque))
     {
         _context.Add(estoque);
         _context.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }