public async Task <IActionResult> Edit(int id, [Bind("Ideventschedule,Idevent,Iduser,Datestart,Dateend")] Eventschedule eventschedule) { if (id != eventschedule.Ideventschedule) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eventschedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventscheduleExists(eventschedule.Ideventschedule)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Idevent"] = new SelectList(_context.Event, "Idevent", "Description", eventschedule.Idevent); ViewData["Iduser"] = new SelectList(_context.User, "Iduser", "Email", eventschedule.Iduser); return(View(eventschedule)); }
public async Task <IActionResult> Create([Bind("Ideventschedule,Idevent,Iduser,Datestart,Dateend")] Eventschedule eventschedule) { if (ModelState.IsValid) { _context.Add(eventschedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Idevent"] = new SelectList(_context.Event, "Idevent", "Description", eventschedule.Idevent); ViewData["Iduser"] = new SelectList(_context.User, "Iduser", "Email", eventschedule.Iduser); return(View(eventschedule)); }