public async Task <IActionResult> Edit(int id, [Bind("Id,Libelle")] Typecategorie typeCategorie) { if (id != typeCategorie.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _typeCategorieService.Update(typeCategorie); } catch (DbUpdateConcurrencyException) { // if (!OperationExists(operation.Id)) // { // return NotFound(); // } // else // { // throw; // } } return(RedirectToAction(nameof(Index))); } return(View(typeCategorie)); }
public async Task <IActionResult> Create([Bind("Id,Libelle")] Typecategorie typecategorie) { if (ModelState.IsValid) { await _typeCategorieService.AddAsync(typecategorie); return(RedirectToAction(nameof(Index))); } return(View(typecategorie)); }