예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,KindPerson,Identify,Name,BithDate")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,DateClientOrder,ClientId")] ClientOrder clientOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", clientOrder.ClientId);
            return(View(clientOrder));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,Quantity,ProductId,ClientOrderId")] ProductOrder productOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientOrderId"] = new SelectList(_context.ClientOrder, "Id", "Id", productOrder.ClientOrderId);
            ViewData["ProductId"]     = new SelectList(_context.Set <Product>(), "Id", "Id", productOrder.ProductId);
            return(View(productOrder));
        }