Skip to content

Instantly share code, notes, and snippets.

@azkurban
azkurban / BsonToGuid.cs
Created November 3, 2022 19:28 — forked from sacarino/BsonToGuid.cs
C# - Generate a GUID from an ObjectID
using System;
using System.Linq;
using MongoDB.Bson;
namespace Extensions
{
internal static class BsonToGuid
{
internal static Guid AsGuid(this BsonObjectId oid)
{
@azkurban
azkurban / ApiController.cs
Created February 5, 2021 14:52 — forked from arruw/ApiController.cs
ASP.NET Core - Generic web API controller with generic repository pattern (created on, modified on, soft delete) ... view demo https://github.com/matjazmav/generic-api
[Authorize]
[Route("api/[controller]")]
public abstract class ApiController<T> : Controller where T : class, IEntity
{
private IApplicationRepository<T> _repository;
public ApiController(IApplicationRepository<T> repository)
{
_repository = repository;
}
@azkurban
azkurban / ApiController.cs
Created February 5, 2021 14:52 — forked from arruw/ApiController.cs
ASP.NET Core - Generic web API controller with generic repository pattern (created on, modified on, soft delete) ... view demo https://github.com/matjazmav/generic-api
[Authorize]
[Route("api/[controller]")]
public abstract class ApiController<T> : Controller where T : class, IEntity
{
private IApplicationRepository<T> _repository;
public ApiController(IApplicationRepository<T> repository)
{
_repository = repository;
}
@azkurban
azkurban / Gobal.asax.cs
Created December 29, 2016 22:55 — forked from shammelburg/Gobal.asax.cs
Angular2 + Windows Authentication
protected void Application_BeginRequest()
{
if (Request.Headers.AllKeys.Contains("Origin") && Request.HttpMethod == "OPTIONS")
{
Response.Flush();
}
}