public ActionResult DeleteConfirmed(int id) { WriteCV writeCV = db.WriteCVs.Find(id); db.WriteCVs.Remove(writeCV); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "WritecvID,User_ID,PreviousWork,Email,Skills,Studies,Languages,Hobbies")] WriteCV writeCV) { if (ModelState.IsValid) { db.Entry(writeCV).State = EntityState.Modified; db.SaveChanges(); //return RedirectToAction("Index"); return(RedirectToAction("Details", "WriteCVs", new { id = writeCV.WritecvID })); } ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID); return(View(writeCV)); }
// GET: WriteCVs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WriteCV writeCV = db.WriteCVs.Find(id); if (writeCV == null) { return(HttpNotFound()); } return(View(writeCV)); }
// GET: WriteCVs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WriteCV writeCV = db.WriteCVs.Find(id); if (writeCV == null) { return(HttpNotFound()); } ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID); return(View(writeCV)); }
// GET: Users/Details/5 public ActionResult Details(/*int? id,*/ string email) { if (email == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //User user = db.Users.Find(id); User user = db.Users.SingleOrDefault(d => d.Email == email); ViewBag.userID = user.User_ID; WriteCV wrcv = db.WriteCVs.SingleOrDefault(d => d.User_ID == user.User_ID); ViewBag.writecv = wrcv.WritecvID; if (user == null) { return(HttpNotFound()); } return(View(user)); }
public ActionResult Create([Bind(Include = "WritecvID,User_ID,PreviousWork,Email,Skills,Studies,Languages,Hobbies")] WriteCV writeCV) { // User user = db.Users.Find(User.Identity.Name.TrimEnd()); User user = db.Users.FirstOrDefault(s => s.Email == User.Identity.Name.TrimEnd()); if (ModelState.IsValid) { writeCV.User_ID = user.User_ID; writeCV.Email = User.Identity.Name.TrimEnd(); db.WriteCVs.Add(writeCV); db.SaveChanges(); //return RedirectToAction("Index"); return(RedirectToAction("Details", "Users", new { email = User.Identity.Name.TrimEnd() })); } ViewBag.User_ID = new SelectList(db.Users, "User_ID", "FirstName", writeCV.User_ID); return(View(writeCV)); }