コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCustomer,CookieID")] Customer customer)
        {
            if (id != customer.IdCustomer)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.IdCustomer))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdOrder,IdCustomer,Date,Time,Price")] Orders orders)
        {
            if (id != orders.IdOrder)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.IdOrder))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(orders));
        }
コード例 #3
0
ファイル: ItemsController.cs プロジェクト: mike0891/IsadMholt
        public async Task <IActionResult> Edit(int id, [Bind("IdItem,Catagory,Name,Url,Price")] Items items)
        {
            if (id != items.IdItem)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(items);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemsExists(items.IdItem))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(items));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IdOrder,IdItem,Quantity")] ItemsOrdered itemsOrdered)
        {
            if (id != itemsOrdered.IdOrder)
            {
                return(NotFound());
            }

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