public ActionResult Edit([Bind(Include = "GroupId,GroupTitle")] PageGroup pageGroup) { if (ModelState.IsValid) { db.Entry(pageGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pageGroup)); }
public ActionResult Edit(News news, HttpPostedFileBase FileUploadImage) { if (ModelState.IsValid) { if (FileUploadImage != null) { if (news.ImageName != "No_Image_Available.jpg") { if (System.IO.File.Exists(Server.MapPath("/NewsImages/" + news.ImageName))) { System.IO.File.Delete(Server.MapPath("/NewsImages/" + news.ImageName)); } } news.ImageName = FileUploadImage.FileName; FileUploadImage.SaveAs(Server.MapPath("/NewsImages/" + news.ImageName)); } db.Entry(news).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GroupId = new SelectList(db.PageGroups, "GroupId", "GroupTitle", news.GroupId); return(View(news)); }
public void UpdatePageGroup(PageGroup pageGroup) { _db.Entry(pageGroup).State = EntityState.Modified; }
public void UpdatePage(Page page) { _ctx.Entry(page).State = EntityState.Modified; }