Ejemplo n.º 1
0
        //
        // GET: /Hint/Create
        public ActionResult Create(int puzzleId)
        {
            Hint hint = new Hint
            {
                PuzzleId = puzzleId,
            };

            return View(hint);
        }
Ejemplo n.º 2
0
        public ActionResult Create(Hint hint)
        {
            if (ModelState.IsValid)
            {
                var hintCount = db.Puzzles.Find(hint.PuzzleId).Hints.Count();
                hint.HintOrder = hintCount + 1;
                db.Hints.Add(hint);
                db.SaveChanges();
                return RedirectToAction("Details", "Puzzle", new { id = hint.PuzzleId });
            }

            return View(hint);
        }
Ejemplo n.º 3
0
        public ActionResult Edit(Hint hint)
        {
            if (ModelState.IsValid)
            {
                db.Entry(hint).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Details", "Puzzle", new { id = hint.PuzzleId });
            }

            return View(hint);
        }