public ActionResult Edit(CategoryTopic categorytopic) { if (ModelState.IsValid) { db.Entry(categorytopic).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categorytopic)); }
public ActionResult Edit(PostModels postmodels) { if (ModelState.IsValid) { db.Entry(postmodels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postmodels)); }
public ActionResult Edit([Bind(Include = "ID,Title,PostDate,AuthorId,Content")] Post post) { if (string.IsNullOrEmpty(post.Title)) { ModelState.AddModelError("Title", "Give your recipe a proper name."); } if (string.IsNullOrEmpty(post.Content)) { ModelState.AddModelError("Content", "You haven't written anything."); } if (ModelState.IsValid) { db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(post)); }