public ActionResult Edit([Bind(Include = "PostID,Author,Title,PublishDate,Content,Website,City,Image,Video")] Post post)
 {
     if (ModelState.IsValid)
     {
         //Edit the post details and save the changes
         db.Entry(post).State = EntityState.Modified;
         post.PublishDate     = DateTime.Now;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(post));
 }
예제 #2
0
 public ActionResult EditPost([Bind(Include = "ID,Title,Author,Website,Content,Image,Video")] Post post)
 {
     try
     {
         if (ModelState.IsValid)
         {
             post.PostDate        = DateTime.Now;        // Setting That The Post Was Updated
             db.Entry(post).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Manage"));
         }
     }
     catch (DataException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(post));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "ID,firstName,lastName,gender,birthDate,City,Latitude,Longitude,seniority")] Fan fan)
 {
     if (ModelState.IsValid)
     {
         //Update the fan according to the input from the user
         db.Entry(fan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fan));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "ID,FirstName,LastName,SexType,BirthDate,Seniority")] Fan fan)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(fan).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(fan));
 }