refactoring
This commit is contained in:
parent
49826eae4a
commit
8e8f4d3896
367 changed files with 217 additions and 364 deletions
21
src/Yavsc.Server/Helpers/HtmlHelpers.cs
Normal file
21
src/Yavsc.Server/Helpers/HtmlHelpers.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Yavsc.Models.Drawing;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
public static class HtmlHelpers
|
||||
{
|
||||
public static HtmlString Color(this Color c)
|
||||
{
|
||||
if (c == null) return new HtmlString("#000");
|
||||
return new HtmlString(String.Format("#{0:X2}{1:X2}{2:X2}", c.Red, c.Green, c.Blue));
|
||||
}
|
||||
public static string ToAbsolute(this HttpRequest request, string url)
|
||||
{
|
||||
var host = request.Host;
|
||||
var isSecure = request.Headers[Constants.SshHeaderKey] == "on";
|
||||
return (isSecure ? "https" : "http") + $"://{host}/{url}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue