Example #1
0
 public ActionResult Edit([Bind(Include = "StudentID,LastName,FirstName,EnrollmentDate")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Example #2
0
        public ActionResult Edit([Bind(Include = "PersonID,FirstName,LastName")] Information information, HttpPostedFileBase File1)
        {
            if (ModelState.IsValid)
            {
                if (File1 != null && File1.ContentLength > 0)
                {
                    information.ProfilePic = new byte[File1.ContentLength]; // file1 to store image in binary formate
                    File1.InputStream.Read(information.ProfilePic, 0, File1.ContentLength);



                    db.Entry(information).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }


            return(View(information));
        }
Example #3
0
 public void Update(T model)
 {
     _context.Entry(model).State = System.Data.Entity.EntityState.Modified;
 }
 public void UpdateByID(T model)                           //to update something in the database.
 {
     _context.Entry(model).State = System.Data.Entity.EntityState.Modified;
 }