public ActionResult Edit([Bind(Include = "ID,Name,Duration")] Plan plan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(plan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(plan));
 }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "UserID,Target,Date")] UserMilestone userMilestone)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userMilestone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.UserInfoes, "ID", "UserID", userMilestone.UserID);
     return(View(userMilestone));
 }
Exemple #3
0
        public ActionResult Edit([Bind(Include = "ID,DaysIn,FactBody,ImageID")] HealthFactMilestone healthFactMilestone)
        {
            if (ModelState.IsValid)
            {
                db.Entry(healthFactMilestone).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(healthFactMilestone));
        }
 public ActionResult Edit([Bind(Include = "BadgeID,DaysIn,BadgeIcon,ImageActiveID,ImageInactiveID")] BadgeMilestone badgeMilestone)
 {
     if (ModelState.IsValid)
     {
         db.Entry(badgeMilestone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ImageActiveID   = new SelectList(db.Images, "ImageID", "ContentType", badgeMilestone.ImageActiveID);
     ViewBag.ImageInactiveID = new SelectList(db.Images, "ImageID", "ContentType", badgeMilestone.ImageInactiveID);
     return(View(badgeMilestone));
 }
Exemple #5
0
        public ActionResult Edit([Bind(Include = "Name,Email,PricePerPack, GoalItem, GoalPrice")] UserInfo userInfo) /*CigsPerDay,StartDate,FinalQuitDate,PlanID*/
        {
            if (ModelState.IsValid)
            {
                var userId = User.Identity.GetUserId();

                UserInfo CurrentUser = db.UserInfoes.Single(p => p.UserID == userId);
                CurrentUser.Name            = userInfo.Name;
                CurrentUser.Email           = userInfo.Email;
                CurrentUser.PricePerPack    = userInfo.PricePerPack;
                CurrentUser.GoalItem        = userInfo.GoalItem;
                CurrentUser.GoalPrice       = userInfo.GoalPrice;
                db.Entry(CurrentUser).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Dashboard", "Home"));
            }
            ViewBag.UserID = new SelectList(db.AspNetUsers, "Id", "Email", userInfo.UserID);
            ViewBag.PlanID = new SelectList(db.Plans, "ID", "Name", userInfo.PlanID);
            return(View(userInfo));
        }