Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerProgress customerProgress = db.CustomerProgresses.Find(id);

            db.CustomerProgresses.Remove(customerProgress);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "Id,CurrentWeight,WeightGoal,UserId")] CustomerProgress customerProgress)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customerProgress).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //ViewBag.UserId = new SelectList(db.ApplicationUsers, "Id", "Email", customerProgress.UserId);
     return(View(customerProgress));
 }
Beispiel #3
0
        // GET: CustomerProgress/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CustomerProgress customerProgress = db.CustomerProgresses.Find(id);

            if (customerProgress == null)
            {
                return(HttpNotFound());
            }
            return(View(customerProgress));
        }
Beispiel #4
0
        // GET: CustomerProgress/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CustomerProgress customerProgress = db.CustomerProgresses.Find(id);

            if (customerProgress == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.UserId = new SelectList(db.ApplicationUsers, "Id", "Email", customerProgress.UserId);
            return(View(customerProgress));
        }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "Id,CurrentWeight,WeightGoal,UserId")] CustomerProgress customerProgress)
        {
            var userId = User.Identity.GetUserId();

            //var theCustomer = db.Users.Where(c => c.Id == userId).Single();

            if (ModelState.IsValid)
            {
                customerProgress.UserId       = userId;
                customerProgress.ProgressDate = DateTime.Today;
                db.CustomerProgresses.Add(customerProgress);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //ViewBag.UserId = new SelectList(db.ApplicationUsers, "Id", "Email", customerProgress.UserId);
            return(View(customerProgress));
        }