/// <inheritdoc /> public async Task <string> RetrieveNameAsync(int key) { if (!await ContainsAsync(key).ConfigureAwait(false)) { throw new KeyNotFoundException($"The provided Key: {key} Not Found in {nameof(NPCEntryModel)} table."); } NPCTemplateModel model = await RetrieveAsync(key) .ConfigureAwait(false); if (model == null) { throw new InvalidOperationException($"Failed to load {nameof(NPCEntryModel)} for Key: {key}"); } return(model.NpcName); }
/// <inheritdoc /> public Task UpdateAsync(int key, NPCTemplateModel model) { GeneralGenericCrudRepositoryProvider <int, NPCTemplateModel> crudProvider = new GeneralGenericCrudRepositoryProvider <int, NPCTemplateModel>(Context.Templates, Context); return(crudProvider.UpdateAsync(key, model)); }
/// <inheritdoc /> public async Task <bool> TryCreateAsync(NPCTemplateModel model) { Context.Templates.Add(model); return((await Context.SaveChangesAsync().ConfigureAwait(false)) != 0); }