Got a profile

dotnet-7.0
Paul Schneider 1 year ago
parent 86aebbdc9c
commit 2562c9a569
9 changed files with 20 additions and 13 deletions

Binary file not shown.

@ -9,7 +9,7 @@ namespace Yavsc.Services
{ {
// TODO ensure a default value at using this: // TODO ensure a default value at using this:
/// <summary> /// <summary>
/// maps a command type name to a bolling code, used to get bill assets /// maps a command type name to a billing code, used to get bill assets
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Dictionary<string,string> BillingMap { get; } Dictionary<string,string> BillingMap { get; }
@ -33,7 +33,7 @@ namespace Yavsc.Services
/// </summary> /// </summary>
/// <param name="activityCode"></param> /// <param name="activityCode"></param>
/// <returns></returns> /// <returns></returns>
Task<IQueryable<ISpecializationSettings>> GetPerformersSettingsAsync(string activityCode); Task<IEnumerable<ISpecializationSettings>> GetPerformersSettingsAsync(string activityCode);
/// <summary> /// <summary>
/// Perfomer settings for the specified performer in the activity /// Perfomer settings for the specified performer in the activity

@ -28,7 +28,6 @@ namespace Yavsc.WebApi.Controllers
_signInManager = signInManager; _signInManager = signInManager;
_logger = loggerFactory.CreateLogger("ApiAuth"); _logger = loggerFactory.CreateLogger("ApiAuth");
_dbContext = dbContext; _dbContext = dbContext;
IViewComponentHelper h;
} }
public UserManager<ApplicationUser> UserManager public UserManager<ApplicationUser> UserManager

@ -32,19 +32,17 @@ namespace Yavsc.Services
public static IDecidableQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId ) => Billing[billingCode](context, queryId); public static IDecidableQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId ) => Billing[billingCode](context, queryId);
public async Task<ISpecializationSettings> GetPerformerSettingsAsync(string activityCode, string userId) public async Task<ISpecializationSettings> GetPerformerSettingsAsync(string activityCode, string userId)
{ {
return await (await GetPerformersSettingsAsync(activityCode)).SingleOrDefaultAsync(s=> s.UserId == userId); return (await GetPerformersSettingsAsync(activityCode)).SingleOrDefault(s=> s.UserId == userId);
} }
public async Task<IQueryable<ISpecializationSettings>> GetPerformersSettingsAsync(string activityCode) public async Task<IEnumerable<ISpecializationSettings>> GetPerformersSettingsAsync(string activityCode)
{ {
var activity = await DbContext.Activities.SingleAsync(a=>a.Code == activityCode); var activity = await DbContext.Activities.SingleAsync(a=>a.Code == activityCode);
if (activity.SettingsClassName==null) return null; if (activity.SettingsClassName==null) return null;
var dbSetPropInfo = UserSettings.SingleOrDefault(s => s.PropertyType.GenericTypeArguments[0].FullName == activity.SettingsClassName);
if (dbSetPropInfo == null) return null; return UserSettings.Where(s => s.PropertyType.GenericTypeArguments[0].FullName == activity.SettingsClassName)
.Cast<ISpecializationSettings>();
return (IQueryable<ISpecializationSettings>) dbSetPropInfo.GetValue(DbContext);
} }
} }
} }

@ -17,6 +17,7 @@ using Microsoft.Extensions.Options;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Services; using Yavsc.Services;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Identity;
namespace Yavsc namespace Yavsc
{ {
@ -250,6 +251,12 @@ namespace Yavsc
{ {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); });
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddDefaultTokenProviders()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddControllersWithViews();
} }
public static IServiceProvider Services { get; private set; } public static IServiceProvider Services { get; private set; }

@ -2,8 +2,8 @@
<div class="performer @(Model.Active?"active":"inactive")"> <div class="performer @(Model.Active?"active":"inactive")">
@Html.DisplayFor(m=>m.UserName) @Html.DisplayFor(m=>m.UserName)
@if (Model.SettingsClassName!=null) @if (!string.IsNullOrWhiteSpace(Model.SettingsClassName))
{ await Html.RenderPartialAsync( Model.SettingsClassName,Model.Settings); } { await Html.RenderPartialAsync(Model.SettingsClassName, Model.Settings); }
@if (Model.WebSite!=null) { @if (Model.WebSite!=null) {
<a target="yaext" href="@Model.WebSite" class="btn btn-info">WebSite: @Model.WebSite</a> <a target="yaext" href="@Model.WebSite" class="btn btn-info">WebSite: @Model.WebSite</a>

@ -25,6 +25,7 @@
@using Microsoft.AspNetCore.Authorization;; @using Microsoft.AspNetCore.Authorization;;
@using Microsoft.AspNetCore.Mvc; @using Microsoft.AspNetCore.Mvc;
@using Microsoft.AspNetCore.Html; @using Microsoft.AspNetCore.Html;
@using Microsoft.AspNetCore.Identity;
@using Yavsc.Helpers; @using Yavsc.Helpers;
@using PayPal.PayPalAPIInterfaceService.Model; @using PayPal.PayPalAPIInterfaceService.Model;
@ -33,3 +34,5 @@
@inject IAuthorizationService AuthorizationService @inject IAuthorizationService AuthorizationService
@inject Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer<Yavsc.Startup> SR @inject Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer<Yavsc.Startup> SR
@inject Microsoft.Extensions.Options.IOptions<SiteSettings> SiteSettings @inject Microsoft.Extensions.Options.IOptions<SiteSettings> SiteSettings
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@ -43,7 +43,7 @@ namespace cli.Commands
var mailer = app.Services.GetService<EMailer>(); var mailer = app.Services.GetService<EMailer>();
var loggerFactory = app.Services.GetService<ILoggerFactory>(); var loggerFactory = app.Services.GetService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<Program>(); var logger = loggerFactory.CreateLogger<Program>();
var userManager = app.Services.GetService<UserManager<ApplicationUser>>(); var userManager = app.Services.GetService<UserManager<ApplicationDbContext>>();
ApplicationDbContext dbContext = app.Services.GetService<ApplicationDbContext>(); ApplicationDbContext dbContext = app.Services.GetService<ApplicationDbContext>();
Func<ApplicationUser, bool> criteria = UserPolicies.Criterias["user-to-remove"]; Func<ApplicationUser, bool> criteria = UserPolicies.Criterias["user-to-remove"];

@ -158,7 +158,6 @@ namespace cli
} }
); );
services.AddTransient(typeof(CompilationEngine), services.AddTransient(typeof(CompilationEngine),
svs => { svs => {
var logger = svs.GetService<ILoggerFactory>().CreateLogger<Startup>(); var logger = svs.GetService<ILoggerFactory>().CreateLogger<Startup>();
@ -175,6 +174,7 @@ namespace cli
PlatformServices.Default.Runtime, PlatformServices.Default.Runtime,
PlatformServices.Default.AssemblyLoadContextAccessor.Default, new CompilationCache())); PlatformServices.Default.AssemblyLoadContextAccessor.Default, new CompilationCache()));
}); });
services.AddTransient(typeof(IFrameworkReferenceResolver), services.AddTransient(typeof(IFrameworkReferenceResolver),
svs => new FrameworkReferenceResolver()); svs => new FrameworkReferenceResolver());

Loading…