Пример #1
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));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "UserID,First_name,Last_name,Email,Months_Until_ID")] Userinfo userinfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userinfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Months_Until_ID = new SelectList(db.Months_Until, "Months_Until_ID", "Months", userinfo.Months_Until_ID);
     return(View(userinfo));
 }