public async Task <IActionResult> Create([Bind("id,First_Name,Last_Name,Contact_Number")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customers));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price,Category")] Products products)
        {
            if (ModelState.IsValid)
            {
                _context.Add(products);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(products));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Staff_Name,Staff_Position")] Staffs staffs)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staffs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffs));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("id,ProductsId,CustomersId,StaffsId")] Sell sell)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sell);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomersId"] = new SelectList(_context.Customers, "id", "id", sell.CustomersId);
            ViewData["ProductsId"]  = new SelectList(_context.Products, "Id", "Id", sell.ProductsId);
            ViewData["StaffsId"]    = new SelectList(_context.Set <Staffs>(), "Id", "Id", sell.StaffsId);
            return(View(sell));
        }