Skip to content

Instantly share code, notes, and snippets.

View jondjones's full-sized avatar

Jon jondjones

View GitHub Profile
@jondjones
jondjones / Umbraco Management API Explained By An Idiot - 5
Created June 21, 2024 07:40
Umbraco Management API Explained By An Idiot - 5
https://localhost:44393/umbraco/management/api/v1/customAPI
@jondjones
jondjones / Umbraco Management API Explained By An Idiot - 4
Created June 21, 2024 07:39
Umbraco Management API Explained By An Idiot - 4
https://localhost:44393/umbraco/swagger/index.html
@jondjones
jondjones / Umbraco Management API Explained By An Idiot - 3
Created June 21, 2024 07:39
Umbraco Management API Explained By An Idiot - 3
https://localhost:44393/umbraco/management/api/v1/
@jondjones
jondjones / Umbraco Management API Explained By An Idiot - 2
Created June 21, 2024 07:39
Umbraco Management API Explained By An Idiot - 2
[VersionedApiBackOfficeRoute("customAPI")]
[ApiExplorerSettings(GroupName = "Custom Group")]
public class MyItemApiController : ManagementApiControllerBase
{
public MyItemApiController()
{
throw new NotImplementedException();
}
@jondjones
jondjones / Umbraco Management API Explained By An Idiot - 1
Created June 21, 2024 07:16
Umbraco Management API Explained By An Idiot - 1
public class SwaggerRouteProductionPipelineFilter() : SwaggerRouteTemplatePipelineFilter("umbraco")
{
protected override bool SwaggerIsEnabled(IApplicationBuilder applicationBuilder) => true;
}
public static class MyConfigureSwaggerRouteUmbracoBuilderExtensions
{
public static IUmbracoBuilder ConfigureProductionSwaggerRoute(this IUmbracoBuilder builder)
{
builder.Services.Configure<UmbracoPipelineOptions>(options =>
@jondjones
jondjones / 7 New Linq Methods You Need To Know About - 8
Created June 10, 2024 07:43
7 New Linq Methods You Need To Know About - 8
var fruits = new List<string> { "apple", "banana", "apple", "orange", "banana", "apple" };
var fruitCount = fruits.GroupBy(fruit => fruit)
.Select(group => new { Fruit = group.Key, Count = group.Count() })
.ToList();
@jondjones
jondjones / 7 New Linq Methods You Need To Know About - 6
Created May 28, 2024 15:59
7 New Linq Methods You Need To Know About - 6
var newProducts = new List<Product>
{
new Product("Laptop", 999.99m)
};
products.ExceptBy(newProducts.Select(p => p.Name), p => p.Name);
// "Smartphone", 699.99m)
// "Headphones", 199.99m)
@jondjones
jondjones / 7 New Linq Methods You Need To Know About - 5
Last active May 28, 2024 15:59
7 New Linq Methods You Need To Know About - 5
products.DistinctBy(x => x.Name)
// "Laptop", 999.99m),
// "Smartphone", 699.99m)
// "Smartwatch", 249.99m)
// "Tablet", 329.99m)
// "Camera", 499.99m)
// "Printer", 149.99m)
// "Monitor", 179.99m)
// "Keyboard", 89.99m)
@jondjones
jondjones / 7 New Linq Methods You Need To Know About - 5
Created May 28, 2024 15:56
7 New Linq Methods You Need To Know About - 5
products.MinBy(f => f.Price);
// "Laptop", 999.99m
@jondjones
jondjones / 7 New Linq Methods You Need To Know About - 4
Created May 28, 2024 15:55
7 New Linq Methods You Need To Know About - 4
products.MinBy(f => f.Price)
// "Mouse", 49.99m