a Startup

dotnet-7.0
Paul Schneider 2 years ago
parent c4b7a5c48d
commit ff2a72f112
19 changed files with 90 additions and 107 deletions

@ -9,20 +9,20 @@
else if (Model.IsLayoutPageSelected) else if (Model.IsLayoutPageSelected)
{ {
@:@@{ @:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"]; @:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile)) if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{ {
@:Layout = "@Model.LayoutPageFile"; @:Layout = "@Model.LayoutPageFile";
} }
@:} @:}
@: @:
@:<h2>@@SR["@Model.ViewName"]</h2> @:<h2>@@Model.ViewName"]</h2>
@: @:
} }
else else
{ {
@:@@{ @:@@{
@:Layout = null; @:Layout = "null";
@:} @:}
@: @:
@:<!DOCTYPE html> @:<!DOCTYPE html>
@ -38,9 +38,9 @@
} }
@:<form asp-action="@Model.ViewName"> @:<form asp-action="@Model.ViewName">
@:<div class="form-horizontal"> @:<div class="form-horizontal">
@:<h4>@@SR["@Model.ViewDataTypeShortName"]</h4> @:<h4>@@Model.ViewDataTypeShortName"]</h4>
@:<hr /> @:<hr />
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div> @:<div asp-validation-summary="ModelOnly" class="text-danger"></div>
foreach (var property in Model.ModelMetadata.Properties) foreach (var property in Model.ModelMetadata.Properties)
{ {
if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly) if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly)
@ -107,7 +107,7 @@
</form> </form>
<div> <div>
<a asp-action="Index">@@SR["Back to List"]</a> <a asp-action="Index">@Back to List</a>
</div> </div>
@{ @{

@ -9,20 +9,20 @@
else if (Model.IsLayoutPageSelected) else if (Model.IsLayoutPageSelected)
{ {
@:@@{ @:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"]; @:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile)) if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{ {
@:Layout = "@Model.LayoutPageFile"; @:Layout = "@Model.LayoutPageFile";
} }
@:} @:}
@: @:
@:<h2>@@SR["@Model.ViewName"]</h2> @:<h2>@@Model.ViewName"]</h2>
@: @:
} }
else else
{ {
@:@@{ @:@@{
@:Layout = null; @:Layout = "null";
@:} @:}
@: @:
@:<!DOCTYPE html> @:<!DOCTYPE html>
@ -30,16 +30,16 @@
@:<html> @:<html>
@:<head> @:<head>
@:<meta name="viewport" content="width=device-width" /> @:<meta name="viewport" content="width=device-width" />
@:<title>@@SR[@Model.ViewName]</title> @:<title>@@@Model.ViewName</title>
@:</head> @:</head>
@:<body> @:<body>
@: @:
// PushIndent(" "); // PushIndent(" ");
} }
} }
<h3>@@SR["AreYourSureYouWantToDeleteThis"]</h3> <h3>@AreYourSureYouWantToDeleteThis</h3>
<div> <div>
<h4>@@SR[@Model.ViewDataTypeShortName]</h4> <h4>@@@Model.ViewDataTypeShortName</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
@{ @{
@ -59,8 +59,8 @@
@: @:
@:<form asp-action="@Model.ViewName"> @:<form asp-action="@Model.ViewName">
@:<div class="form-actions no-color"> @:<div class="form-actions no-color">
@:<input type="submit" value="@@SR["Delete"]" class="btn btn-default" /> | @:<input type="submit" value="@Delete" class="btn btn-default" /> |
@:<a asp-action="Index">@@SR["Back to List"]</a> @:<a asp-action="Index">Back to List</a>
@:</div> @:</div>
@:</form> @:</form>
@:</div> @:</div>

@ -9,20 +9,20 @@
else if (Model.IsLayoutPageSelected) else if (Model.IsLayoutPageSelected)
{ {
@:@@{ @:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"]; @:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile)) if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{ {
@:Layout = "@Model.LayoutPageFile"; @:Layout = "@Model.LayoutPageFile";
} }
@:} @:}
@: @:
@:<h2>@@SR["@Model.ViewName"]</h2> @:<h2>@@Model.ViewName"]</h2>
@: @:
} }
else else
{ {
@:@@{ @:@@{
@:Layout = null; @:Layout = "null";
@:} @:}
@: @:
@:<!DOCTYPE html> @:<!DOCTYPE html>
@ -61,13 +61,13 @@
string pkName = GetPrimaryKeyName(); string pkName = GetPrimaryKeyName();
if (pkName != null) if (pkName != null)
{ {
@:<a asp-action="Edit" asp-route-id="@@Model.@pkName">@@SR["Edit"]</a> | @:<a asp-action="Edit" asp-route-id="@@Model.@pkName">@Edit</a> |
@:<a asp-action="Index">@@SR["Back to List"]</a> @:<a asp-action="Index">Back to List</a>
} }
else else
{ {
@:@@Html.ActionLink(@@SR["Edit"], "Edit", new { /* id = Model.PrimaryKey */ }) | @:@@Html.ActionLink(@Edit, "Edit", new { /* id = Model.PrimaryKey */ }) |
@:<a asp-action="Index">@@SR["Back to List"]</a> @:<a asp-action="Index">Back to List</a>
} }
}</p> }</p>
@{ @{

@ -9,20 +9,20 @@
else if (Model.IsLayoutPageSelected) else if (Model.IsLayoutPageSelected)
{ {
@:@@{ @:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"]; @:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile)) if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{ {
@:Layout = "@Model.LayoutPageFile"; @:Layout = "@Model.LayoutPageFile";
} }
@:} @:}
@: @:
@:<h2>@@SR["@Model.ViewName"]</h2> @:<h2>@@Model.ViewName"]</h2>
@: @:
} }
else else
{ {
@:@@{ @:@@{
@:Layout = null; @:Layout = "null";
@:} @:}
@: @:
@:<!DOCTYPE html> @:<!DOCTYPE html>
@ -30,7 +30,7 @@
@:<html> @:<html>
@:<head> @:<head>
@:<meta name="viewport" content="width=device-width" /> @:<meta name="viewport" content="width=device-width" />
@:<title>@@SR["@Model.ViewName"]</title> @:<title>@@Model.ViewName"]</title>
@:</head> @:</head>
@:<body> @:<body>
@: @:
@ -40,7 +40,7 @@
@:<div class="form-horizontal"> @:<div class="form-horizontal">
@:<h4>@Model.ViewDataTypeShortName</h4> @:<h4>@Model.ViewDataTypeShortName</h4>
@:<hr /> @:<hr />
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div> @:<div asp-validation-summary="ModelOnly" class="text-danger"></div>
foreach (PropertyMetadata property in Model.ModelMetadata.Properties) foreach (PropertyMetadata property in Model.ModelMetadata.Properties)
{ {
if (property.Scaffold) if (property.Scaffold)
@ -111,7 +111,7 @@
</form> </form>
<div> <div>
<a asp-action="Index">@@SR["Back to List"]</a> <a asp-action="Index">Back to List</a>
</div> </div>
@{ @{

@ -9,20 +9,20 @@
else if (Model.IsLayoutPageSelected) else if (Model.IsLayoutPageSelected)
{ {
@:@@{ @:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"]; @:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile)) if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{ {
@:Layout = "@Model.LayoutPageFile"; @:Layout = "@Model.LayoutPageFile";
} }
@:} @:}
@: @:
@:<h2>@@SR["@Model.ViewName"]</h2> @:<h2>@@Model.ViewName"]</h2>
@: @:
} }
else else
{ {
@:@@{ @:@@{
@:Layout = null; @:Layout = "null";
@:} @:}
@: @:
@:<!DOCTYPE html> @:<!DOCTYPE html>
@ -30,13 +30,13 @@
@:<html> @:<html>
@:<head> @:<head>
@:<meta name="viewport" content="width=device-width" /> @:<meta name="viewport" content="width=device-width" />
@:<title>@@SR["@Model.ViewName"]</title> @:<title>@@Model.ViewName"]</title>
@:</head> @:</head>
@:<body> @:<body>
// PushIndent(" "); // PushIndent(" ");
} }
@:<p> @:<p>
@:<a asp-action="Create">@@SR["Create New"]</a> @:<a asp-action="Create">Create New</a>
@:</p> @:</p>
@:<table class="table"> @:<table class="table">
@:<tr> @:<tr>
@ -69,17 +69,17 @@
if (pkName != null) if (pkName != null)
{ {
@:<td> @:<td>
@:<a asp-action="Edit" asp-route-id="@@item.@pkName">@@SR["Edit"]</a> | @:<a asp-action="Edit" asp-route-id="@@item.@pkName">@Edit</a> |
@:<a asp-action="Details" asp-route-id="@@item.@pkName">@@SR["Details"]</a> | @:<a asp-action="Details" asp-route-id="@@item.@pkName">@Details</a> |
@:<a asp-action="Delete" asp-route-id="@@item.@pkName">@@SR["Delete"]</a> @:<a asp-action="Delete" asp-route-id="@@item.@pkName">@Delete</a>
@:</td> @:</td>
} }
else else
{ {
<td> <td>
@@Html.ActionLink(SR["Edit"], "Edit",new { /* id=item.PrimaryKey */ }) | @@Html.ActionLink("Edit", "Edit",new { /* id=item.PrimaryKey */ }) |
@@Html.ActionLink(SR["Details"], "Details", new { /* id=item.PrimaryKey */ }) | @@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@@Html.ActionLink(SR["Delete"], "Delete", new { /* id=item.PrimaryKey */ }) @@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td> </td>
} }
@:</tr> @:</tr>

@ -19,6 +19,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar namespace Yavsc.Models.Calendar
{ {

@ -19,6 +19,8 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar namespace Yavsc.Models.Calendar
{ {
public interface IScheduledEvent public interface IScheduledEvent

@ -0,0 +1,9 @@
using Yavsc.Models.Calendar;
namespace Yavsc.Server.Models.Calendar
{
public class Availability : List<Period>
{
}
}

@ -22,7 +22,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Calendar namespace Yavsc.Server.Models.Calendar
{ {
/// <summary> /// <summary>
/// Hollydays. /// Hollydays.

@ -19,7 +19,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.Calendar namespace Yavsc.Server.Models.Calendar
{ {
/// <summary> /// <summary>
/// Periodicity. /// Periodicity.

@ -21,9 +21,10 @@
namespace Yavsc.Models.Calendar using Yavsc.Models.Relationship;
namespace Yavsc.Server.Models.Calendar
{ {
using Models.Relationship;
/// <summary> /// <summary>
/// Position and keyphrase. /// Position and keyphrase.
/// </summary> /// </summary>

@ -21,6 +21,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar namespace Yavsc.Models.Calendar
{ {

@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Attributes.Validation; using Yavsc.Attributes.Validation;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Calendar; using Yavsc.Models.Calendar;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Server.Models.EMailing namespace Yavsc.Server.Models.EMailing
{ {

@ -1,6 +1,6 @@
using System; using System;
using Yavsc.Models.Calendar; using Yavsc.Models.Calendar;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.ViewModels.Calendar namespace Yavsc.ViewModels.Calendar
{ {

@ -1,27 +1,20 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container. using Microsoft.AspNetCore;
builder.Services.AddControllersWithViews();
var app = builder.Build(); namespace Yavsc
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{ {
app.UseExceptionHandler("/Home/Error"); public class Program
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. {
app.UseHsts(); public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) {
return WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build();
}
}
} }
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

@ -42,7 +42,7 @@ namespace Yavsc
static IAuthorizationService AuthorizationService { get; set; } static IAuthorizationService AuthorizationService { get; set; }
public void ConfigureFileServerApp(IApplicationBuilder app, public void ConfigureFileServerApp(IApplicationBuilder app,
SiteSettings siteSettings, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, SiteSettings siteSettings, IWebHostEnvironment env,
IAuthorizationService authorizationService) IAuthorizationService authorizationService)
{ {
AuthorizationService = authorizationService; AuthorizationService = authorizationService;

@ -9,7 +9,7 @@ namespace Yavsc
public partial class Startup public partial class Startup
{ {
public void CheckApp(Microsoft.AspNetCore.Hosting.IHostingEnvironment env, public void CheckApp(IWebHostEnvironment env,
ILoggerFactory loggerFactory) ILoggerFactory loggerFactory)
{ {

@ -89,6 +89,7 @@ namespace Yavsc
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddSignalR();
// Database connection // Database connection
@ -241,26 +242,21 @@ namespace Yavsc
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); });
} }
static ApplicationDbContext _dbContext;
private UserManager<ApplicationUser> _usermanager;
public static IServiceProvider Services { get; private set; } public static IServiceProvider Services { get; private set; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure( public void Configure(
IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, IApplicationBuilder app,
ApplicationDbContext dbContext, IOptions<SiteSettings> siteSettings, IOptions<SiteSettings> siteSettings,
IOptions<RequestLocalizationOptions> localizationOptions,
IAuthorizationService authorizationService, IAuthorizationService authorizationService,
IOptions<PayPalSettings> payPalSettings, IOptions<PayPalSettings> payPalSettings,
IOptions<GoogleAuthSettings> googleSettings, IOptions<GoogleAuthSettings> googleSettings,
IStringLocalizer<Yavsc.YavscLocalisation> localizer, IStringLocalizer<Yavsc.YavscLocalisation> localizer,
UserManager<ApplicationUser> usermanager, ILoggerFactory loggerFactory,
ILoggerFactory loggerFactory) IWebHostEnvironment env)
{ {
Services = app.ApplicationServices; Services = app.ApplicationServices;
_dbContext = dbContext;
_usermanager = usermanager;
GoogleSettings = googleSettings.Value; GoogleSettings = googleSettings.Value;
ResourcesHelpers.GlobalLocalizer = localizer; ResourcesHelpers.GlobalLocalizer = localizer;
SiteSetup = siteSettings.Value; SiteSetup = siteSettings.Value;
@ -319,7 +315,7 @@ namespace Yavsc
// 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
app.UseSession(); app.UseSession();
@ -335,35 +331,13 @@ namespace Yavsc
_logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify)); _logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify));
CheckApp(env, loggerFactory); CheckApp(env, loggerFactory);
} app.UseEndpoints(endpoints =>
// Entry point for the application.
public static void Main(string[] args) {
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{ {
app.UseExceptionHandler("/Error"); endpoints.MapHub<ChatHub>("/chat");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. });
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.MapHub<ChatHub>("/chatHub");
app.Run();
} }
} }
} }
// //

@ -16,6 +16,7 @@
<PackageReference Include="MimeKit" Version="3.6.0" /> <PackageReference Include="MimeKit" Version="3.6.0" />
<PackageReference Include="pazof.rules" Version="1.1.3" /> <PackageReference Include="pazof.rules" Version="1.1.3" />
<PackageReference Include="RazorEngine.NetCore" Version="3.1.0" /> <PackageReference Include="RazorEngine.NetCore" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
</ItemGroup> </ItemGroup>

Loading…