public async Task <IActionResult> UpdateItem([FromBody] AConMvcClass systemHtml) { if (string.IsNullOrEmpty(systemHtml.Guid)) { systemHtml.Guid = Guid.NewGuid().ToString("D"); } var aConMvcCompileClass = AConMvcCompileClass.ToCompileClass(systemHtml); var result = await DbFactory.Queryable <AConMvcClass>().Where(p => p.Id == systemHtml.Id).FirstAsync(); if (result != null) { _actionProvider.RemoveController(aConMvcCompileClass); _dynamicChangeTokenProvider.NotifyChanges(); result = systemHtml; } var reint = await DbFactory.Updateable(result).ExecuteCommandAsync(); if (systemHtml.IsEanable.ToBool() == true) { try { _actionProvider.AddControllers(aConMvcCompileClass); _dynamicChangeTokenProvider.NotifyChanges(); return(Json(new { isok = true })); } catch (Exception ex) { return(Json(new { isok = false, err = ex.Message })); } } return(Json(new { isok = reint >= 0 })); }
public static async Task ClearAllDynamicActions(DynamicActionProvider dynamicActionProvider, DynamicChangeTokenProvider dynamicChangeToken) { var allactios = DB.UniClient.Queryable <AConMvcClass>().Where(p => p.IsEanable != null && p.IsEanable == true).ToList(); try { foreach (var c in allactios) { var classes = AConMvcCompileClass.ToCompileClass(c); dynamicActionProvider.RemoveController(classes); dynamicChangeToken.NotifyChanges(); Thread.Sleep(20); } } catch { } }