public async Task <IActionResult> Edit(int id, [Bind("Title,Description,Link,State,Id")] CapsuleInformative capsuleInformative) { if (id != capsuleInformative.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _capsuleInformativeRepo.Update(capsuleInformative); } catch (DbUpdateConcurrencyException) { if (!CapsuleInformativeExists(capsuleInformative.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(capsuleInformative)); }
private async void Une_capsule() { var mockRepo = new MockCapsulesInformativesRepository(); var signalements = await mockRepo.GetAll(); _capsuleInformative = signalements.First(); }
public async Task <IActionResult> Create([Bind("Title,Description,Link,Status,Id")] CapsuleInformative capsuleInformative) { if (ModelState.IsValid) { await _capsuleInformativeRepo.Add(capsuleInformative); return(RedirectToAction(nameof(Index))); } return(View(capsuleInformative)); }