mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Make .netcoreapp 3.0 build happy
This commit is contained in:
parent
aaa05eb5ec
commit
e75edac3c1
@ -72,6 +72,7 @@
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp2.1'">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0"></PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -393,7 +393,7 @@ namespace BTCPayServer.Controllers
|
||||
!transactionOutput.SubtractFeesFromOutput)
|
||||
vm.AddModelError(model => model.Outputs[i].SubtractFeesFromOutput,
|
||||
"You are sending your entire balance to the same destination, you should subtract the fees",
|
||||
ModelState);
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ namespace BTCPayServer.Controllers
|
||||
foreach (var subtractFeesOutput in subtractFeesOutputsCount)
|
||||
{
|
||||
vm.AddModelError(model => model.Outputs[subtractFeesOutput].SubtractFeesFromOutput,
|
||||
"You can only subtract fees from one output", ModelState);
|
||||
"You can only subtract fees from one output", this);
|
||||
}
|
||||
}else if (vm.CurrentBalance == transactionAmountSum && !substractFees)
|
||||
{
|
||||
@ -415,7 +415,7 @@ namespace BTCPayServer.Controllers
|
||||
for (var i = 0; i < vm.Outputs.Count; i++)
|
||||
{
|
||||
vm.AddModelError(model => model.Outputs[i].Amount,
|
||||
"You are sending more than what you own", ModelState);
|
||||
"You are sending more than what you own", this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace BTCPayServer
|
||||
!decimal.TryParse(match.Groups[1].Value, out var v))
|
||||
return false;
|
||||
|
||||
var currency = match.Groups.Last().Value.ToUpperInvariant();
|
||||
var currency = match.Groups[match.Groups.Count - 1].Value.ToUpperInvariant();
|
||||
var currencyData = _CurrencyTable.GetCurrencyData(currency, false);
|
||||
if (currencyData == null)
|
||||
return false;
|
||||
|
@ -1,29 +1,29 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
#if NETCOREAPP21
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
|
||||
#else
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
#endif
|
||||
|
||||
namespace BTCPayServer
|
||||
{
|
||||
public static class ModelStateExtensions
|
||||
{
|
||||
public static void AddModelError<TModel, TProperty>(
|
||||
this ModelStateDictionary modelState,
|
||||
Expression<Func<TModel, TProperty>> ex,
|
||||
string message
|
||||
)
|
||||
{
|
||||
var key = ExpressionHelper.GetExpressionText(ex);
|
||||
modelState.AddModelError(key, message);
|
||||
}
|
||||
|
||||
public static void AddModelError<TModel, TProperty>(this TModel source,
|
||||
Expression<Func<TModel, TProperty>> ex,
|
||||
string message,
|
||||
ModelStateDictionary modelState)
|
||||
Controller controller)
|
||||
{
|
||||
#if NETCOREAPP21
|
||||
var key = ExpressionHelper.GetExpressionText(ex);
|
||||
modelState.AddModelError(key, message);
|
||||
#else
|
||||
var provider = (ModelExpressionProvider)controller.HttpContext.RequestServices.GetService(typeof(ModelExpressionProvider));
|
||||
var key = provider.GetExpressionText(ex);
|
||||
#endif
|
||||
controller.ModelState.AddModelError(key, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
|
||||
|
||||
namespace BTCPayServer.Filters
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if NETCOREAPP21
|
||||
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||
#else
|
||||
using Microsoft.Extensions.Hosting;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using System;
|
||||
|
@ -3,7 +3,6 @@ using NBitcoin;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Internal;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
|
||||
namespace BTCPayServer.ModelBinders
|
||||
|
@ -10,6 +10,8 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if NETCOREAPP21
|
||||
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||
#else
|
||||
using Microsoft.Extensions.Hosting;
|
||||
#endif
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
|
@ -1,5 +1,3 @@
|
||||
@using Microsoft.EntityFrameworkCore.Internal
|
||||
@using Microsoft.EntityFrameworkCore.Storage
|
||||
@model BTCPayServer.Models.AppViewModels.ContributeToCrowdfund
|
||||
|
||||
<form method="post">
|
||||
@ -8,7 +6,7 @@
|
||||
<div class="card mb-4 perk expanded" id="@item.Id">
|
||||
@if (Model.ViewCrowdfundViewModel.DisplayPerksRanking && Model.ViewCrowdfundViewModel.PerkCount.ContainsKey(item.Id))
|
||||
{
|
||||
<span class="btn btn-sm rounded-circle px-0 btn-primary perk-badge">#@(Model.ViewCrowdfundViewModel.Perks.IndexOf(item)+1)</span>
|
||||
<span class="btn btn-sm rounded-circle px-0 btn-primary perk-badge">#@(Array.IndexOf(Model.ViewCrowdfundViewModel.Perks, item) + 1)</span>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(item.Image))
|
||||
{
|
||||
@ -31,12 +29,12 @@
|
||||
@item.Price.Value
|
||||
if (item.Custom)
|
||||
{
|
||||
Safe.Raw("or more");
|
||||
@Safe.Raw("or more");
|
||||
}
|
||||
}
|
||||
else if (item.Custom)
|
||||
{
|
||||
Safe.Raw("Any amount");
|
||||
@Safe.Raw("Any amount");
|
||||
}
|
||||
|
||||
</span>
|
||||
|
@ -16,12 +16,12 @@
|
||||
<li>
|
||||
@if (Model.LogFileOffset > 0)
|
||||
{
|
||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)"><<</a>
|
||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)"><<</a>
|
||||
}
|
||||
Showing @Model.LogFileOffset - (@(Model.LogFileOffset+Model.LogFiles.Count)) of @Model.LogFileCount
|
||||
@if ((Model.LogFileOffset+ Model.LogFiles.Count) < Model.LogFileCount)
|
||||
{
|
||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">>></a>
|
||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">>></a>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user