public async Task <IActionResult> Edit(string id, [Bind("Id,Title,Description,StartDate,EndDate")] LearningRessource learningRessource) { if (id != learningRessource.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(learningRessource); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LearningRessourceExists(learningRessource.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(learningRessource)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,StartDate,EndDate")] LearningRessource learningRessource) { if (ModelState.IsValid) { _context.Add(learningRessource); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(learningRessource)); }