public ActionResult Index() { _sessionStorage.WebCommandController.TurnOn(); var webViewModel = new WebViewModel() { Grid = _sessionStorage.WebCommandController.View.OutPut, IsRobotPlaced = _sessionStorage.WebCommandController.View.Grid.Robot.IsPlaced }; return View(webViewModel); }
public ActionResult Index(WebViewModel model) { var webViewModel = new WebViewModel(); string error = string.Empty; try { if (ModelState.IsValid) { _sessionStorage.WebCommandController.Command(model.Command); } } catch (Exception e) { //Logger code goes here webViewModel.ErrorMessage = "Error occurred while executing command. Please enter valid command and try again."; } webViewModel.Grid = _sessionStorage.WebCommandController.View.OutPut; webViewModel.IsRobotPlaced = _sessionStorage.WebCommandController.View.Grid.Robot.IsPlaced; return View(webViewModel); }