public async Task <IActionResult> Edit(int id, [Bind("IdOrder,IdClub,IdMenu,DateForDay,Count")] Order order)
        {
            if (id != order.IdOrder)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.IdOrder))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdMenu"] = new SelectList(_context.Menu, "IdMenu", "IdMenu", order.IdMenu);
            return(View(order));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdCity,NameCity")] City city)
        {
            if (id != city.IdCity)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.IdCity))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(city));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdMenu,NameDose,Description,Price,ImageUri,Categorya")] Menu menu)
        {
            if (id != menu.IdMenu)
            {
                return(NotFound());
            }

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