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)
{
@:@@{
@:ViewData["Title"] = @@SR["@Model.ViewName"];
@:ViewData["Title"] = @@Model.ViewName"];
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{
@:Layout = "@Model.LayoutPageFile";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:<h2>@@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:Layout = "null";
@:}
@:
@:<!DOCTYPE html>
@ -38,9 +38,9 @@
}
@:<form asp-action="@Model.ViewName">
@:<div class="form-horizontal">
@:<h4>@@SR["@Model.ViewDataTypeShortName"]</h4>
@:<h4>@@Model.ViewDataTypeShortName"]</h4>
@:<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)
{
if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly)
@ -107,7 +107,7 @@
</form>
<div>
<a asp-action="Index">@@SR["Back to List"]</a>
<a asp-action="Index">@Back to List</a>
</div>
@{
@ -142,4 +142,4 @@
{
return string.Equals("System.Guid", property.TypeName, StringComparison.OrdinalIgnoreCase);
}
}
}

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

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

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

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

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

@ -19,6 +19,8 @@
// 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/>.
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar
{
public interface IScheduledEvent
@ -31,4 +33,4 @@ namespace Yavsc.Models.Calendar
Period Period { get; set; }
}
}
}

@ -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.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Calendar
namespace Yavsc.Server.Models.Calendar
{
/// <summary>
/// Hollydays.

@ -19,7 +19,7 @@
// 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/>.
namespace Yavsc.Models.Calendar
namespace Yavsc.Server.Models.Calendar
{
/// <summary>
/// Periodicity.

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

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

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

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

@ -1,27 +1,20 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
using Microsoft.AspNetCore;
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
namespace Yavsc
{
app.UseExceptionHandler("/Home/Error");
// 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 class Program
{
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; }
public void ConfigureFileServerApp(IApplicationBuilder app,
SiteSettings siteSettings, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
SiteSettings siteSettings, IWebHostEnvironment env,
IAuthorizationService authorizationService)
{
AuthorizationService = authorizationService;

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

@ -89,6 +89,7 @@ namespace Yavsc
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
// Database connection
@ -241,26 +242,21 @@ namespace Yavsc
options.ResourcesPath = "Resources";
});
}
static ApplicationDbContext _dbContext;
private UserManager<ApplicationUser> _usermanager;
public static IServiceProvider Services { get; private set; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(
IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
ApplicationDbContext dbContext, IOptions<SiteSettings> siteSettings,
IOptions<RequestLocalizationOptions> localizationOptions,
IApplicationBuilder app,
IOptions<SiteSettings> siteSettings,
IAuthorizationService authorizationService,
IOptions<PayPalSettings> payPalSettings,
IOptions<GoogleAuthSettings> googleSettings,
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
UserManager<ApplicationUser> usermanager,
ILoggerFactory loggerFactory)
ILoggerFactory loggerFactory,
IWebHostEnvironment env)
{
Services = app.ApplicationServices;
_dbContext = dbContext;
_usermanager = usermanager;
GoogleSettings = googleSettings.Value;
ResourcesHelpers.GlobalLocalizer = localizer;
SiteSetup = siteSettings.Value;
@ -319,7 +315,7 @@ namespace Yavsc
// before fixing the security protocol, let beleive our lib it's done with it.
var cxmgr = PayPal.Manager.ConnectionManager.Instance;
// then, fix it.
ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
// ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
app.UseSession();
@ -335,35 +331,13 @@ namespace Yavsc
_logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify));
CheckApp(env, loggerFactory);
}
// 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.UseEndpoints(endpoints =>
{
app.UseExceptionHandler("/Error");
// 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();
endpoints.MapHub<ChatHub>("/chat");
});
}
}
}
//

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

Loading…