This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Dimention2D ComputeSize(Image image, int? maxWidth, int? maxHeight) | |
{ | |
if (image == null) throw new ArgumentNullException(nameof(image)); | |
if (maxWidth <= 0) throw new ArgumentOutOfRangeException(nameof(maxWidth)); | |
if (maxHeight <= 0) throw new ArgumentOutOfRangeException(nameof(maxHeight)); | |
if (image.Width <= 0) throw new ArgumentOutOfRangeException(nameof(image.Width)); | |
if (image.Height <= 0) throw new ArgumentOutOfRangeException(nameof(image.Height)); | |
var sourceDimension = new Dimention2D(image.Width, image.Height); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DevelpmentWallMiddleware | |
{ | |
private readonly RequestDelegate _next; | |
private readonly string _password; | |
private readonly string _username; | |
public DevelpmentWallMiddleware(RequestDelegate next, string username, string password) | |
{ | |
_next = next; | |
_username = username; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class IQueryableExtensions | |
{ | |
public async static Task<PagedItems<T>> ToPagedItemsAsync<T>(this IQueryable<T> source, int pageSize, int pageIndex = 1) | |
{ | |
var count = await source.CountAsync().ConfigureAwait(false); | |
var collection = await source | |
.Skip((pageIndex - 1) * pageSize) | |
.Take(pageSize) | |
.ToListAsync().ConfigureAwait(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNet.Razor.TagHelpers; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Hosting; | |
using System; | |
namespace ProjectName.TagHelpers | |
{ | |
[HtmlTargetElement("html", Attributes = MinifyAttributeName)] | |
public class HtmlMinifierTagHelper : TagHelper |