Exemple #1
0
        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));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Productsid,Customersid,Locationid,StaffsId")] Sells sells)
        {
            if (id != sells.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sells);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SellsExists(sells.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Customersid"] = new SelectList(_context.Customers, "id", "id", sells.Customersid);
            ViewData["Locationid"]  = new SelectList(_context.Location, "id", "id", sells.Locationid);
            ViewData["Productsid"]  = new SelectList(_context.Products, "id", "id", sells.Productsid);
            ViewData["StaffsId"]    = new SelectList(_context.Staffs, "id", "id", sells.StaffsId);
            return(View(sells));
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,address,number,email")] Location location)
        {
            if (id != location.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Exemple #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));
        }
        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));
        }