예제 #1
0
        //
        // GET: /Hint/Create
        public ActionResult Create(int puzzleId)
        {
            Hint hint = new Hint
            {
                PuzzleId = puzzleId,
            };

            return View(hint);
        }
예제 #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);
        }
예제 #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);
        }