public void RemovePgTask(int? id)
 {
     PgTask t = new PgTask();
     t = db.PgTasks.Find(id);
     db.PgTasks.Remove(t);
     db.SaveChanges();
 }
 internal object Entry(PgTask pgTask)
 {
     throw new NotImplementedException();
 }
 public void AddPgTask(PgTask t)
 {
     db.PgTasks.Add(t);
     db.SaveChanges();
 }
        public ActionResult Details(PgTask pgTask, int? score, string answer)
        {
            //if (ModelState.IsValid)
            //{

            //    return RedirectToAction("Index");
            //}
            //pgTask.EncodeText(pgTask.PgTaskAnswer);

            ViewBag.answer=pgTask.CheckAnswer(pgTask.PgTaskAnswer);

            score = score == null ? 0 : score;
            if (answer.ToLower() == pgTask.PgTaskString.ToLower())
            {
                ViewBag.Message = "Rätt svar!";
                ViewBag.Score = score + 1;

                return View(pgTask);
            }
            else
            {
                ViewBag.Message = "You were wrong, please try again.";
                ViewBag.Score = score;
                return View(pgTask);
            }

            return View(pgTask);
        }