コード例 #1
0
ファイル: TypesController.cs プロジェクト: Semerak/SmartLunch
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name_type")] Types types)
        {
            if (id != types.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(types);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypesExists(types.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(types));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,DishesID,Q_time,Quantity")] Quantities quantities)
        {
            if (id != quantities.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(quantities);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuantitiesExists(quantities.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DishesID"] = new SelectList(_context.Dishes, "ID", "ID", quantities.DishesID);
            return(View(quantities));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name_dish,TypesID,description")] Dishes dishes)
        {
            if (id != dishes.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dishes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DishesExists(dishes.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TypesID"] = new SelectList(_context.Types, "ID", "ID", dishes.TypesID);
            return(View(dishes));
        }