got Abstraction
This commit is contained in:
parent
28667942c4
commit
36002d8ef8
11 changed files with 118 additions and 80 deletions
4
Makefile
4
Makefile
|
|
@ -2,7 +2,7 @@
|
||||||
MONO_PREFIX=/home/paul/mono46
|
MONO_PREFIX=/home/paul/mono46
|
||||||
DNX_USER_HOME=/home/paul/.dnx
|
DNX_USER_HOME=/home/paul/.dnx
|
||||||
DNXLIBS=Microsoft.Dnx.Host.Mono.dll Microsoft.Dnx.Host.dll Microsoft.Dnx.ApplicationHost.dll Microsoft.Dnx.Loader.dll Microsoft.Dnx.Compilation.Abstractions.dll Microsoft.Dnx.Compilation.CSharp.Abstractions.dll Microsoft.CodeAnalysis.dll Microsoft.CodeAnalysis.CSharp.dll Microsoft.Dnx.Compilation.CSharp.Common.dll Microsoft.Dnx.Compilation.CSharp.dll Microsoft.Dnx.Compilation.dll Microsoft.Dnx.Runtime.dll Microsoft.Dnx.Runtime.Internals.dll Microsoft.Extensions.PlatformAbstractions.dll System.Collections.Immutable.dll System.Reflection.Metadata.dll
|
DNXLIBS=Microsoft.Dnx.Host.Mono.dll Microsoft.Dnx.Host.dll Microsoft.Dnx.ApplicationHost.dll Microsoft.Dnx.Loader.dll Microsoft.Dnx.Compilation.Abstractions.dll Microsoft.Dnx.Compilation.CSharp.Abstractions.dll Microsoft.CodeAnalysis.dll Microsoft.CodeAnalysis.CSharp.dll Microsoft.Dnx.Compilation.CSharp.Common.dll Microsoft.Dnx.Compilation.CSharp.dll Microsoft.Dnx.Compilation.dll Microsoft.Dnx.Runtime.dll Microsoft.Dnx.Runtime.Internals.dll Microsoft.Extensions.PlatformAbstractions.dll System.Collections.Immutable.dll System.Reflection.Metadata.dll
|
||||||
DNXLIBFP:=$(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS))
|
DNXLIBFP:=./packages/System.Diagnostics.DiagnosticSource/4.0.0-beta-23516/lib/portable-net45+win8+wp8+wpa81/System.Diagnostics.DiagnosticSource.dll $(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS))
|
||||||
CONFIG=Debug
|
CONFIG=Debug
|
||||||
|
|
||||||
yavscd=yavscd
|
yavscd=yavscd
|
||||||
|
|
@ -79,7 +79,7 @@ yavscassemblies: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$
|
||||||
|
|
||||||
yavscd: yavscassemblies updatedeps
|
yavscd: yavscassemblies updatedeps
|
||||||
mkdir -p binaries/$(CONFIG)
|
mkdir -p binaries/$(CONFIG)
|
||||||
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(shell ls private/lib/*.dll) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o $(yavscd)
|
mkbundle --deps $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(shell ls private/lib/*.dll) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o $(yavscd)
|
||||||
|
|
||||||
strip_yavscd: $(yavscd)
|
strip_yavscd: $(yavscd)
|
||||||
strip $(yavscd)
|
strip $(yavscd)
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
"tests"
|
"tests"
|
||||||
],
|
],
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "1.0.0-rc1-update2",
|
"version": "7.0.202",
|
||||||
"runtime": "mono",
|
"runtime": "dotnet",
|
||||||
"architecture": "x64"
|
"architecture": "x64"
|
||||||
},
|
},
|
||||||
"packages": "packages"
|
"packages": "packages"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
"msbuild": {
|
"msbuild": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
|
"scriptcs": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
"Dnx": {
|
"Dnx": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"enablePackageRestore": false,
|
"enablePackageRestore": false,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
using System.Resources;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Paul Schneider 2014-2019")]
|
|
||||||
[assembly: AssemblyTrademark("Yavsc")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: NeutralResourcesLanguage("fr")]
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.6.1")]
|
|
||||||
16
src/Yavsc.Abstract/Yavsc.Abstract.csproj
Normal file
16
src/Yavsc.Abstract/Yavsc.Abstract.csproj
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
{
|
|
||||||
"version": "1.0.8-*",
|
|
||||||
"title": "Yavsc - l'abstrait",
|
|
||||||
"description": "Yavsc common objects",
|
|
||||||
"authors": [
|
|
||||||
"Paul Schneider <paul@pschneider.fr>"
|
|
||||||
],
|
|
||||||
"packOptions": {
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/pazof/yavsc"
|
|
||||||
},
|
|
||||||
"licenseUrl": "https://github.com/pazof/yavsc/blob/vnext/LICENSE",
|
|
||||||
"requireLicenseAcceptance": true,
|
|
||||||
"owners": [
|
|
||||||
"Paul Schneider <paul@pschneider.fr>"
|
|
||||||
],
|
|
||||||
"summary": "Yet another very small company",
|
|
||||||
"projectUrl": "http://yavsc.pschneider.fr",
|
|
||||||
"tags": [
|
|
||||||
"Blog",
|
|
||||||
"PoS",
|
|
||||||
"Chat"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"buildOptions": {
|
|
||||||
"nowarn": ["IDE1006"]
|
|
||||||
},
|
|
||||||
"tooling": {
|
|
||||||
"defaultNamespace": "Yavsc"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"Newtonsoft.Json": "7.0.1"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"dnx451": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net46": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net461": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net452": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net451": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -148,5 +149,36 @@ namespace Yavsc.Controllers
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Authorize("AdministratorOnly")]
|
||||||
|
public async Task<IActionResult> DeleteAllLike(long? id)
|
||||||
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
Bug bugref = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||||
|
if (bugref == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var bugs = _context.Bug.Where(b => b.Description == bugref.Description);
|
||||||
|
return View(bugs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Bug/Delete/5
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
[Authorize("AdministratorOnly")]
|
||||||
|
public async Task<IActionResult> DeleteAllLikeConfirmed(long id)
|
||||||
|
{
|
||||||
|
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||||
|
var bugs = await _context.Bug.Where(b => b.Description == bug.Description).ToArrayAsync();
|
||||||
|
foreach (var btd in bugs)
|
||||||
|
_context.Bug.Remove(btd);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,18 @@ namespace Yavsc.Services
|
||||||
{
|
{
|
||||||
readonly SiteSettings siteSettings;
|
readonly SiteSettings siteSettings;
|
||||||
readonly SmtpSettings smtpSettings;
|
readonly SmtpSettings smtpSettings;
|
||||||
|
private readonly ILogger logger;
|
||||||
|
|
||||||
public MailSender(
|
public MailSender(
|
||||||
IOptions<SiteSettings> sitesOptions,
|
IOptions<SiteSettings> sitesOptions,
|
||||||
IOptions<SmtpSettings> smtpOptions
|
IOptions<SmtpSettings> smtpOptions,
|
||||||
|
ILoggerFactory loggerFactory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
siteSettings = sitesOptions?.Value;
|
siteSettings = sitesOptions?.Value;
|
||||||
smtpSettings = smtpOptions?.Value;
|
smtpSettings = smtpOptions?.Value;
|
||||||
|
logger = loggerFactory.CreateLogger<MailSender>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -40,6 +44,7 @@ namespace Yavsc.Services
|
||||||
EmailSentViewModel model = new EmailSentViewModel{ EMail = email };
|
EmailSentViewModel model = new EmailSentViewModel{ EMail = email };
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
logger.LogInformation($"SendEmailAsync for {email}: {message}");
|
||||||
MimeMessage msg = new MimeMessage();
|
MimeMessage msg = new MimeMessage();
|
||||||
msg.From.Add(new MailboxAddress(
|
msg.From.Add(new MailboxAddress(
|
||||||
siteSettings.Owner.Name,
|
siteSettings.Owner.Name,
|
||||||
|
|
@ -59,6 +64,7 @@ namespace Yavsc.Services
|
||||||
smtpSettings.Host,
|
smtpSettings.Host,
|
||||||
smtpSettings.Port,
|
smtpSettings.Port,
|
||||||
SecureSocketOptions.Auto);
|
SecureSocketOptions.Auto);
|
||||||
|
|
||||||
if (smtpSettings.UserName!=null) {
|
if (smtpSettings.UserName!=null) {
|
||||||
NetworkCredential creds = new NetworkCredential(
|
NetworkCredential creds = new NetworkCredential(
|
||||||
smtpSettings.UserName, smtpSettings.Password, smtpSettings.Domain);
|
smtpSettings.UserName, smtpSettings.Password, smtpSettings.Domain);
|
||||||
|
|
@ -68,6 +74,7 @@ namespace Yavsc.Services
|
||||||
await sc.SendAsync(msg);
|
await sc.SendAsync(msg);
|
||||||
model.MessageId = msg.MessageId;
|
model.MessageId = msg.MessageId;
|
||||||
model.Sent = true; // a duplicate info to remove from the view model, that equals to MessageId == null
|
model.Sent = true; // a duplicate info to remove from the view model, that equals to MessageId == null
|
||||||
|
logger.LogInformation($"Sent : {msg}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,7 @@ namespace Yavsc
|
||||||
options.AuthenticationDescriptions.Clear();
|
options.AuthenticationDescriptions.Clear();
|
||||||
options.AutomaticAuthentication = false;
|
options.AutomaticAuthentication = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
|
||||||
ConfigureOAuthApp(app);
|
ConfigureOAuthApp(app);
|
||||||
|
|
|
||||||
53
src/Yavsc/Views/Bug/DeleteAllLike.cshtml
Normal file
53
src/Yavsc/Views/Bug/DeleteAllLike.cshtml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
@model IEnumerable<Yavsc.Models.IT.Fixing.Bug>
|
||||||
|
@inject IStringLocalizer<Yavsc.Models.IT.Fixing.Resources> SRR
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = @SR["DeleteAllLike"];
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>@SR["Index"]</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create">@SR["Create New"]</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@SR[Html.DisplayNameFor(model => model.Id)]
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@SR[Html.DisplayNameFor(model => model.Title)]
|
||||||
|
</td>
|
||||||
|
<th>
|
||||||
|
@SR[Html.DisplayNameFor(model => model.FeatureId)]
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@SR[Html.DisplayNameFor(model => model.Status)]
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (var item in Model) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(model => item.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(model => item.Title)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.FeatureId)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
@SRR[typeof(Yavsc.Models.IT.Fixing.BugStatus).GetEnumNames()[(int)item.Status]]
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Edit" asp-route-id="@item.Id">@SR["Edit"]</a> |
|
||||||
|
<a asp-action="Details" asp-route-id="@item.Id">@SR["Details"]</a> |
|
||||||
|
<a asp-action="DeleteAllLike" asp-route-id="@item.Id">@SR["Delete"]</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
|
@ -456,7 +456,7 @@ namespace yavscTests
|
||||||
app.UseWelcomePage("/welcome");
|
app.UseWelcomePage("/welcome");
|
||||||
|
|
||||||
// before fixing the security protocol, let beleive our lib it's done with it.
|
// before fixing the security protocol, let beleive our lib it's done with it.
|
||||||
var cxmgr = PayPal.Manager.ConnectionManager.Instance;
|
//var cxmgr = PayPal.Manager.ConnectionManager.Instance;
|
||||||
// then, fix it.
|
// then, fix it.
|
||||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
|
ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue