public ActionResult DeleteConfirmed(int id) { Studentdocs studentdocs = db.Studentdocs.Find(id); db.Studentdocs.Remove(studentdocs); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StudentId,date,profile,education,family,other")] Studentdocs studentdocs) { if (ModelState.IsValid) { db.Entry(studentdocs).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentdocs)); }
// GET: Studentdocs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Studentdocs studentdocs = db.Studentdocs.Find(id); if (studentdocs == null) { return(HttpNotFound()); } return(View(studentdocs)); }
public ActionResult Create([Bind(Include = "Id,StudentId,date,profile,education,family,other")] Studentdocs studentdocs, HttpPostedFileBase file, IEnumerable <HttpPostedFileBase> file1, IEnumerable <HttpPostedFileBase> file2, IEnumerable <HttpPostedFileBase> file3) { if (ModelState.IsValid) { string edu = null, fam = null, oth = null; foreach (var a in file1) { edu = Help.uploadfile(a); studentdocs.education = edu; studentdocs.family = ""; studentdocs.other = ""; studentdocs.StudentId = student; db.Studentdocs.Add(studentdocs); db.SaveChanges(); } foreach (var b in file2) { fam = Help.uploadfile(b); studentdocs.education = ""; studentdocs.family = fam; studentdocs.other = ""; studentdocs.StudentId = student; db.Studentdocs.Add(studentdocs); db.SaveChanges(); } foreach (var c in file3) { oth = Help.uploadfile(c); studentdocs.education = ""; studentdocs.family = ""; studentdocs.other = oth; studentdocs.StudentId = student; db.Studentdocs.Add(studentdocs); db.SaveChanges(); } studentdocs.profile = Help.uploadfile(file); db.Studentdocs.Add(studentdocs); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentdocs)); }