public ActionResult DeleteConfirmed(int id) { FPRInFace fPRInFace = db.FPRInFaces.Find(id); db.FPRInFaces.Remove(fPRInFace); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: FPRInFaces/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FPRInFace fPRInFace = db.FPRInFaces.Find(id); if (fPRInFace == null) { return(HttpNotFound()); } return(View(fPRInFace)); }
public ActionResult Edit([Bind(Include = "Id,FIO,Biography,Achivments")] HttpPostedFileBase PhotoPath, FPRInFace fPRInFace, string oldPhotoPath) { if (ModelState.IsValid) { if (PhotoPath != null) { string filename = PhotoPath.FileName; PhotoPath.SaveAs(Server.MapPath("/Images/FPRInFace/" + filename)); fPRInFace.PhotoPath = "/Images/FPRInFace/" + filename; } else { fPRInFace.PhotoPath = oldPhotoPath; } db.Entry(fPRInFace).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fPRInFace)); }
public ActionResult Create([Bind(Include = "Id,FIO,Biography,Achivments")] HttpPostedFileBase PhotoPath, FPRInFace fPRInFace) { if (ModelState.IsValid) { if (PhotoPath != null) { string filename = PhotoPath.FileName; PhotoPath.SaveAs(Server.MapPath("/Images/FPRInFace/" + filename)); fPRInFace.PhotoPath = "/Images/FPRInFace/" + filename; } db.FPRInFaces.Add(fPRInFace); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fPRInFace)); }