I need some advise and help please. I am a newbie to MVC and programming in general.
Model:
public class WorkflowStepsViewModel
{
public Dictionary<string, string[]> stageData { get; set; }
public Dictionary<string, List<string>> stepData { get; set; }
}
Controller:
public IActionResult Criteria(CriteriaViewModel model)
{
WorkflowStepsViewModel stepModel = new WorkflowStepsViewModel();
if (ModelState.IsValid)
{
//call GetSteps class
GetSteps steps = new GetSteps();
var stageData = steps.GetStages(model);
var stepData = steps.GetStep(stageData);
stepModel.stageData = stageData;
stepModel.stepData = stepData;
ViewData["stepData"] = stepData;
ViewData["stageData"] = stageData;
return RedirectToAction("GetWorkflow", "GetWorkflow", ViewData);
}
else
{
//show error
return View();
}
}
I want to use the values and keys in both the dictionaries in the view.. but I don't know how. Any help would be great. Should I split my model so that each model has 1 dictionary? I thought I could set the values in the model from controller and then use it in view.. but idk how I would call each key and value. TIA for your help.