Example #1
0
        public async Task <IActionResult> Create([Bind("Egn,Name,Adress,Tel")] Clients clients)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clients);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clients));
        }
        public async Task <IActionResult> Create([Bind("DistrId,Name,TelContact")] Distributors distributors)
        {
            if (ModelState.IsValid)
            {
                _context.Add(distributors);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(distributors));
        }
        public async Task <IActionResult> Create([Bind("Clients,Distributors,Number,Naimenovanie,Quantity,Price,Data")] Products products)
        {
            if (ModelState.IsValid)
            {
                _context.Add(products);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Clients"]      = new SelectList(_context.Clients, "Egn", "Egn", products.Clients);
            ViewData["Distributors"] = new SelectList(_context.Distributors, "DistrId", "Name", products.Distributors);
            return(View(products));
        }