Example #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            TypingChallenge typingChallenge = db.TypingChallenges.Find(id);

            db.TypingChallenges.Remove(typingChallenge);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,WPM,Accuracy")] TypingChallenge typingChallenge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typingChallenge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typingChallenge));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "Id,Name,WPM,Accuracy")] TypingChallenge typingChallenge)
        {
            if (ModelState.IsValid)
            {
                typingChallenge.Id = Guid.NewGuid();
                db.TypingChallenges.Add(typingChallenge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(typingChallenge));
        }
Example #4
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypingChallenge typingChallenge = db.TypingChallenges.Find(id);

            if (typingChallenge == null)
            {
                return(HttpNotFound());
            }
            return(View(typingChallenge));
        }