public ActionResult DeleteConfirmed(int id) { Custom_User_List custom_User_List = db.Custom_User_List.Find(id); db.Custom_User_List.Remove(custom_User_List); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Custom_User_List/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Custom_User_List custom_User_List = db.Custom_User_List.Find(id); if (custom_User_List == null) { return(HttpNotFound()); } return(View(custom_User_List)); }
// GET: Custom_User_List/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Custom_User_List custom_User_List = db.Custom_User_List.Find(id); if (custom_User_List == null || custom_User_List.User_ID != User.Identity.GetUserId()) { return(HttpNotFound()); } ViewBag.Status_ID = new SelectList(db.Progress_Status, "Progress_Status_ID", "Status_Name", custom_User_List.Status_ID); return(View(custom_User_List)); }
public ActionResult Edit([Bind(Include = "Custom_List_ID,User_ID,Stuff_to_do_ID,Status_ID")] Custom_User_List custom_User_List) { if (ModelState.IsValid) { if (custom_User_List.User_ID != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } db.Entry(custom_User_List).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Status_ID = new SelectList(db.Progress_Status, "Progress_Status_ID", "Status_Name", custom_User_List.Status_ID); custom_User_List.Stuff_To_Do = db.Stuff_To_Do.Find(custom_User_List.Stuff_to_do_ID); return(View(custom_User_List)); }
public ActionResult Create([Bind(Include = "Stuff_To_Do_ID,Months_Until_ID,Todo_Items,Description,User_ID")] Stuff_To_Do stuff_To_Do) { if (ModelState.IsValid) { var User_ID = User.Identity.GetUserId(); var userProfile = db.Userinfoes.Find(User_ID); var customUserList = new Custom_User_List { Status_ID = 1, Stuff_To_Do = stuff_To_Do, }; stuff_To_Do.User_ID = User_ID; userProfile.Custom_User_List.Add(customUserList); db.Entry(userProfile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Custom_User_List")); } return(PartialView(stuff_To_Do)); }