Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Titel")] Produktart produktart)
        {
            if (id != produktart.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(produktart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProduktartExists(produktart.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(produktart));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ID,Titel")] Produktart produktart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(produktart);
                await _context.SaveChangesAsync();

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