public ActionResult EditMark([Bind(Include = "MarkId,Total,Obtain,CourseId,StudentId")] Mark mark) { if (ModelState.IsValid) { db.Entry(mark).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Result")); }
public ActionResult Edit([Bind(Include = "CourseId,CourseName,Description,TeacherId")] Course course) { if (ModelState.IsValid) { db.Entry(course).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(course)); }
public ActionResult Upload(HttpPostedFileBase upload) { string id = User.Identity.GetUserId(); s = db.Students.Where(x => x.Id.Equals(id)).FirstOrDefault(); s.ImageName = System.IO.Path.GetFileName(upload.FileName); s.ContentType = upload.ContentType; using (var reader = new System.IO.BinaryReader(upload.InputStream)) { s.Content = reader.ReadBytes(upload.ContentLength); } db.Entry(s).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Redirect("/Manage")); }