Gremlin/Gremlin_BlazorServer/Pages/Quotes/QuoteCreate.razor.cs

31 lines
1.1 KiB
C#

using System.Security.Claims;
using Gremlin_BlazorServer.Data.EntityClasses;
using Gremlin_BlazorServer.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
namespace Gremlin_BlazorServer.Pages.Quotes;
public partial class QuoteCreate {
private IList<Product>? foundProducts;
private IList<LineItem>? lineItems;
private string optionNumber = "";
private string productNumber = "";
private Product selectedProduct;
[CascadingParameter] private Task<AuthenticationState>? AuthenticationStateTask { get; set; }
protected override async Task OnInitializedAsync() {
if (AuthenticationStateTask != null) {
ClaimsPrincipal user = (await AuthenticationStateTask).User;
if (user.Identity is { IsAuthenticated: true }) {
// quotes = await GenericController.GetAllAsync<Quote>();
}
}
await base.OnInitializedAsync();
}
private async Task OnSearchChanged() => foundProducts = await GenericController.GetAllAsync<Product>(p => p.ProductNumber.Contains(productNumber) && p.OptionNumber.Contains(optionNumber));
private void OnSelectedProductChanged(Product product) => selectedProduct = product;
}