internal async Task <Modifier> Modifier(ModifierCategory modCategory, ModifierKey modKey) { if ( !modCategory.Name().Equals(ModifierCategoryName.Default) && modKey.Equals(ModifierKey.Default) ) { var app = await modCategory.App(); modCategory = await app.ModCategory(ModifierCategoryName.Default); } var record = await factory.DB .Modifiers .Retrieve() .Where(m => m.CategoryID == modCategory.ID.Value && m.ModKey == modKey.Value) .FirstOrDefaultAsync(); if (record == null) { record = await factory.DB .Modifiers .Retrieve() .Where(m => m.ModKey == ModifierKey.Default.Value) .FirstOrDefaultAsync(); } return(factory.Modifier(record)); }
private IQueryable <ModifierRecord> modifiersForCategory(ModifierCategory modCategory) { return(factory.DB .Modifiers .Retrieve() .Where(m => m.CategoryID == modCategory.ID.Value)); }
internal async Task <Modifier> Modifier(ModifierCategory category, string targetKey) { var record = await modifiersForCategory(category) .Where(m => m.TargetKey == targetKey) .FirstOrDefaultAsync(); return(factory.Modifier(record)); }
internal Task <ResourceGroup[]> Groups(ModifierCategory modCategory) => factory.DB .ResourceGroups .Retrieve() .Where(g => g.ModCategoryID == modCategory.ID.Value) .OrderBy(g => g.Name) .Select(g => factory.Group(g)) .ToArrayAsync();
public Task SetModCategory(ModifierCategory category) => factory.DB .ResourceGroups .Update ( record, r => { r.ModCategoryID = category.ID.Value; } );
internal async Task <Modifier> Add(ModifierCategory category, ModifierKey modKey, string targetID, string displayText) { var record = new ModifierRecord { CategoryID = category.ID.Value, ModKey = modKey.Value, TargetKey = targetID, DisplayText = displayText }; await factory.DB.Modifiers.Create(record); return(factory.Modifier(record)); }
internal Task <Modifier[]> Modifiers(ModifierCategory category) { return(modifiersForCategory(category) .Select(m => factory.Modifier(m)) .ToArrayAsync()); }
internal async Task <ResourceGroup> Add(AppVersion version, ResourceGroupName name, ModifierCategory modCategory) { var record = new ResourceGroupRecord { VersionID = version.ID.Value, Name = name.Value, ModCategoryID = modCategory.ID.Value }; await factory.DB.ResourceGroups.Create(record); return(factory.Group(record)); }