public Task <Template> UpsertAsync(string appId, string code, TemplateUpdate update, CancellationToken ct = default) { Guard.NotNullOrEmpty(appId, nameof(appId)); Guard.NotNullOrEmpty(code, nameof(code)); Guard.NotNull(update, nameof(update)); return(Updater.UpdateRetriedAsync(5, async() => { var(template, etag) = await repository.GetAsync(appId, code, ct); if (template == null) { template = Template.Create(appId, code); } template.Update(update); await repository.UpsertAsync(template, etag, ct); return template; })); }
public void Update(TemplateUpdate update) { IsAutoCreated = false; if (update.Formatting != null) { Formatting = update.Formatting; } else { Formatting ??= new NotificationFormatting <LocalizedText>(); } if (update.Settings != null) { Settings = update.Settings; } else { Settings ??= new NotificationSettings(); } }