public async Task <DataProviderGetRecords <BlogEntry> > GetItemsAsync(int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) { DataProviderGetRecords <BlogEntry> recs = await DataProvider.GetRecordsAsync(skip, take, sort, filters); // TODO: This could be optimized for SQL using joins %%%%%%%%%%%%%%%%%%% foreach (BlogEntry blogEntry in recs.Data) { await ObjectSupport.HandlePropertyAsync <MultiString>("Category", "GetCategoryAsync", blogEntry); } return(recs); }
// API // API // API public async Task <BlogEntry> GetItemAsync(int blogEntry) { BlogEntry data = await DataProvider.GetAsync(blogEntry); if (data == null) { return(null); } // TODO: This could be optimized for SQL using joins %%%%%%%%%%%%%%%%%%% await ObjectSupport.HandlePropertyAsync <MultiString>("Category", "GetCategoryAsync", data); data.Identity = blogEntry; return(data); }
public async Task <ActionResult> ModuleEdit_Partial(ModuleEditModel model) { if (model.ModuleGuid == Guid.Empty) { throw new InternalError("No moduleGuid provided"); } // we need to find the real type of the module for data binding ModuleDefinition origModule = await ModuleDefinition.LoadAsync(model.ModuleGuid); await ObjectSupport.HandlePropertyAsync <List <PageDefinition> >(nameof(ModuleDefinition.Pages), nameof(ModuleDefinition.__GetPagesAsync), origModule); ModuleDefinition mod = (ModuleDefinition) await GetObjectFromModelAsync(origModule.GetType(), nameof(model.Module)); if (!ModelState.IsValid) { return(PartialView(model)); } mod.CustomValidation(ModelState, "Module."); if (!ModelState.IsValid) { return(PartialView(model)); } model.Module = mod; await model.UpdateDataAsync(); Manager.CurrentModuleEdited = model.Module; ObjectSupport.CopyData(origModule, model.Module, ReadOnly: true); // update read only properties in model in case there is an error ObjectSupport.CopyDataFromOriginal(origModule, model.Module); // copy/save model.Module.Temporary = false; await model.Module.SaveAsync(); return(FormProcessed(model, this.__ResStr("okSaved", "Module settings saved"))); }
internal static Task HandlePropertiesAsync(object data) { return(ObjectSupport.HandlePropertyAsync <MenuList>("Commands", "__GetCommandsAsync", data)); }
internal async Task UpdateDataAsync() { await ObjectSupport.HandlePropertyAsync <List <PageDefinition> >(nameof(ModuleDefinition.Pages), nameof(ModuleDefinition.__GetPagesAsync), Module); }