Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 public void UpdatePageGroup(PageGroup pageGroup)
 {
     _db.Entry(pageGroup).State = EntityState.Modified;
 }
Esempio n. 4
0
 public void UpdatePage(Page page)
 {
     _ctx.Entry(page).State = EntityState.Modified;
 }