Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/Seq.Api/ResourceGroups/EntityResourceGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,21 @@ internal EntityResourceGroup(string name, ISeqConnection connection) : base(name
protected async Task<TResponse> GroupCreateAsync<TEntity, TResponse>(TEntity entity,
IDictionary<string, object> parameters = null) where TEntity : ILinked
{
var link = entity.Links.ContainsKey("Create") ? "Create" : "Items";
var group = await LoadGroupAsync().ConfigureAwait(false);
return await Client.PostAsync<TEntity, TResponse>(group, link, entity, parameters).ConfigureAwait(false);
ILinked resource;
string link;

if (entity.Links.ContainsKey("Create"))
{
resource = entity;
link = "Create";
}
else
{
resource = await LoadGroupAsync().ConfigureAwait(false);
link = "Items";
}

return await Client.PostAsync<TEntity, TResponse>(resource, link, entity, parameters).ConfigureAwait(false);
}
}
}
}