Beispiel #1
0
        public async Task<IActionResult> Edit(int id, [Bind("idSkoleni,nazev,popis,skolitel")] Models.PSkoleni skoleni)
        {
            ViewData["adminVolba"] = 3;
            if (id != skoleni.idSkoleni)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(skoleni);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SkoleniExists(skoleni.idSkoleni))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(skoleni);
        }
Beispiel #2
0
 public async Task<IActionResult> Create([Bind("idSkoleni,nazev,popis,skolitel")] Models.PSkoleni skoleni)
 {
     ViewData["adminVolba"] = 3;
     if (ModelState.IsValid)
     {
         _context.Add(skoleni);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(skoleni);
 }