public async Task <IViewComponentResult> InvokeAsync(ErrandReportFormViewModel model)
        {
            if (model == null || model.WizardPageNr == 0)
            {
                model = this._httpContext.Session.GetJson <ErrandReportFormViewModel>("ErrandReportFormViewModel");
                return(View("ReportForm", model));
            }
            if ((this._httpContext.Request.Method == "POST") && (model.WizardPageNr == 1))
            {
                if (!ModelState.IsValid)
                {
                    model.WizardPageNr--;
                    return(View("ReportForm", model));
                }
                this._httpContext.Session.SetJson("ErrandReportFormViewModel", model);
                return(View("ReportValidate", model));
            }
            if (model.WizardPageNr == 2)
            {
                IErrand errandAsset = this._httpContext.RequestServices.GetRequiredService <IErrand>();
                model = this._httpContext.Session.GetJson <ErrandReportFormViewModel>("ErrandReportFormViewModel");
                model = await errandAsset.SaveErrand(model);

                this._httpContext.Session.SetJson("ErrandReportFormViewModel", null);
                return(View("ReportThanks", model));
            }
            throw new System.Exception("Error in ErrandREportWizard.");
        }
 public IActionResult ErrandReport(ErrandReportFormViewModel model, int wizpagenr)
 {
     model.WizardPageNr = wizpagenr;
     return(ViewComponent("ErrandReportWizard", model));
 }