コード例 #1
0
        public async Task <IActionResult> Create([Bind("IdUser,Username,Password,Name,Lastname,Dob,IdStatus,Image")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("IdPay,IdProduct,IdCus,PaymentDate,Totalprice")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(payment));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("IdProduct,ProductName,Image,Price,Unit")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("IdCus,NameCus,LastnameCus,AddressCus,TelCus")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customers));
        }