Example #1
0
        //  [ValidateAntiForgeryToken]
        public async Task <IActionResult> Edit(int id, [Bind("ShopId,ShopName,PhoneNumber,WebsiteUrl,City")] Shops shops)
        {
            if (id != shops.ShopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shops);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShopsExists(shops.ShopId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shops));
        }
Example #2
0
        // [ValidateAntiForgeryToken]
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FullName,UserName,PhoneNumber,EmailAddress")] Customers customers)
        {
            if (id != customers.CustomerId)
            {
                return(NotFound());
            }

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