public async Task <IActionResult> AddAction(AddActionViewModel viewModel) { bool isValid = AppActionType.TryParse(Request.Form["Type"], out AppActionType type); if (isValid) { AppAction action = new AppAction() { AppRuleId = viewModel.AppRuleId, Type = viewModel.Type, Field = viewModel.Field, Para = viewModel.Para }; db.AppActions.Add(action); await db.SaveChangesAsync(); } return(Ok()); }