public async Task <IActionResult> Edit(int id, [Bind("id,First_Name,Last_Name,Contact_Number")] Customers customers)
        {
            if (id != customers.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomersExists(customers.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customers));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price,Category")] Products products)
        {
            if (id != products.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(products);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductsExists(products.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(products));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("id,ProductsId,CustomersId,StaffsId")] Sell sell)
        {
            if (id != sell.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sell);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SellExists(sell.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Staff_Name,Staff_Position")] Staffs staffs)
        {
            if (id != staffs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffsExists(staffs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffs));
        }