Example #1
0
        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"));
        }
Example #2
0
        // 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));
        }
Example #3
0
        // 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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }