Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CurrentWeight currentWeight = db.CurrentWeights.Find(id);

            db.CurrentWeights.Remove(currentWeight);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ID,UserID,weight")] CurrentWeight currentWeight)
 {
     if (ModelState.IsValid)
     {
         db.Entry(currentWeight).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(currentWeight));
 }
Beispiel #3
0
        // GET: CurrentWeights/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CurrentWeight currentWeight = db.CurrentWeights.Find(id);

            if (currentWeight == null)
            {
                return(HttpNotFound());
            }
            return(View(currentWeight));
        }
Beispiel #4
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Weight")
        {
            correctingWeight = other.gameObject.GetComponent <CorrectingWeight>();
            currentWeight    = other.gameObject.GetComponent <CurrentWeight>();

            if (!isPlatformL)
            {
                gameLogic.SetPlatfWeight_R(currentWeight.weight);
                platformController.SetRightText(currentWeight.weight);
            }
            if (isPlatformL)
            {
                gameLogic.SetPlatfWeight_L(currentWeight.weight);
                correctingWeight.ClapToPlatform();
                platformController.SetLeftText(currentWeight.weight);
            }
        }
    }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "ID,UserID,weight,today")] CurrentWeight currentWeight)
        {
            currentWeight.UserID = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                var datetimenow    = DateTime.Now;
                var userid         = User.Identity.GetUserId();
                var todayCompleted = db.CurrentWeights.OrderByDescending(i => i.today).Where(u => u.UserID == userid).Select(t => t.today).FirstOrDefault();
                if (todayCompleted.ToString("MM dd, yyyy") != datetimenow.ToString("MM dd, yyyy"))
                {
                    currentWeight.today = DateTime.Now;
                    db.CurrentWeights.Add(currentWeight);
                    db.SaveChanges();
                    return(RedirectToAction("Exercises", "Home"));
                }
                //db.CurrentWeights.Add(currentWeight);
                //db.SaveChanges();
                return(RedirectToAction("DaysOver", "CurrentWeights"));
            }

            return(View(currentWeight));
        }