Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Icon")] TableDeliveryOption tableDeliveryOption)
        {
            if (id != tableDeliveryOption.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tableDeliveryOption);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableDeliveryOptionExists(tableDeliveryOption.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(tableDeliveryOption));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Description,Icon")] TableDeliveryOption tableDeliveryOption)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tableDeliveryOption);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(tableDeliveryOption));
        }