예제 #1
0
        public ActionResult EdTable(Order item)
        {
            var data = _context.Orders.FirstOrDefault(x => x.OrderID == item.OrderID);

            if (data != null)
            {
                data.Amount = item.Amount;
                _context.Update(data);
                _context.SaveChanges();
                return(RedirectToAction("Det", new { id = item.TableID }));
            }

            return(RedirectToAction("OrderPage"));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Type,FID,FoodName,Price")] Menu menu)
        {
            if (id != menu.FID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(menu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MenuExists(menu.FID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(menu));
        }
예제 #3
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,Email,Name,LName,Password,JTitle")] Employee employee)
        {
            if (id != employee.ID)
            {
                return(NotFound());
            }

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