// // GET: /Hint/Create public ActionResult Create(int puzzleId) { Hint hint = new Hint { PuzzleId = puzzleId, }; return View(hint); }
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); }
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); }