protected override void OnInitialized() { base.OnInitialized(); _editContext = new EditContext(Model); if (FormProvider != null) { FormProvider.AddForm(this); } if (OnFieldChanged.HasDelegate) { _editContext.OnFieldChanged += OnFieldChangedHandler; } if (OnValidationRequested.HasDelegate) { _editContext.OnValidationRequested += OnValidationRequestedHandler; } if (OnValidationStateChanged.HasDelegate) { _editContext.OnValidationStateChanged += OnValidationStateChangedHandler; } if (ValidateMode.IsIn(FormValidateMode.Rules, FormValidateMode.Complex)) { _editContext.OnFieldChanged += RulesModeOnFieldChanged; _editContext.OnValidationRequested += RulesModeOnValidationRequested; } }
public async Task <IActionResult> AddForm([FromBody] FormViewModel formViewModel) { var companyId = this.User.Claims.SingleOrDefault(c => c.Type == "companyId").Value; var form = mapper.Map <FormViewModel, Form>(formViewModel); form.CompanyId = companyId; form.Created = DateTime.Now; form = await formProvider.AddForm(form); formViewModel = mapper.Map <Form, FormViewModel>(form); return(Ok(formViewModel)); }