I am new to asp.net, what I really want is to give a parameter to an ActionResult.
I want somtehing like this (I dont know if this is possible)
Sudoku s = new Sudoku(); // SudokuClass has a property -> public int[,] MyFields {get;set;} public ActionResult Index(int value) { if(value == 1) { myGame.Create(); s.MyFields = myGame.GameField(); } if(value == 2) { myGame.Cheat(); s.MyFields = myGame.GameField(); } if(value == 3) // some code return View(s); } MyCode is Index.cshtml
@Html.ActionLink("Cheat", "Index") What i want is: if I click on the actionlink "Cheat", that i can give number 2 so the Cheat Method will start, and update s.MyFields;
The other code for displaying the fields I have omitted. I can get the fields show on the webpage when I use s.MyFields = mygame.GetFields(). So thats not the problem, the problem is how can I "Update" this when I Click on cheat.
@Html.ActionLink("Cheat", "Index", new { value = 2 })