// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Region).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegionExists(Region.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public IActionResult Edit(Paragraphe paragraphe) { /// /// update de tous les champs _context.Paragraphes.Update(paragraphe); /// //************** /// ///update d'un seul champ /// _context.Attach <Paragraphe>(paragraphe); //connection sur la valeur dans la table en passant par entity //_context.Entry(paragraphe).Property(item => item.Titre).IsModified=true; _context.SaveChanges(); return(View(paragraphe)); }