hfgdjg sghgsg

This commit is contained in:
Adam 2024-06-26 19:56:29 +02:00
commit 8d8487d727
11 changed files with 189 additions and 130 deletions

View File

@ -5,6 +5,20 @@ namespace TIAM.Database.Test;
public static class TestHelper
{
public static TransferDestinationToProduct CreateTransferDestinationToProduct(Guid transferDestinationToProductId, Guid transferDestId, Guid productId)
{
var transferDestinationToProduct = new TransferDestinationToProduct();
transferDestinationToProduct.Id = transferDestinationToProductId;
transferDestinationToProduct.ProductId = productId;
transferDestinationToProduct.TransferDestinationId = transferDestId;
transferDestinationToProduct.Price = 5000;
transferDestinationToProduct.Price2 = 6000;
transferDestinationToProduct.Price3 = 8000;
transferDestinationToProduct.ProductCommis = 0.1d;
return transferDestinationToProduct;
}
public static TransferDestination CreateTransferDestination(Guid transferDestId, Guid addressId)
{
var name = "Liszt Ferenc repülőtér";

View File

@ -70,7 +70,7 @@ namespace TIAM.Database.DataLayers.Admins
#endregion Transfer
#region TransferDestination
public List<TransferDestination>? GetTransferDestinations() => Session(ctx=>ctx.GetTransferDestinations().ToList());
public List<TransferDestination> GetTransferDestinations() => Session(ctx=>ctx.GetTransferDestinations().ToList());
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId) => Session(ctx=>ctx.GetTransferDestinationById(transferDestinationId));
public Task<TransferDestination?> GetTransferDestinationByIdAsync(Guid transferDestinationId) => SessionAsync(ctx=>ctx.GetTransferDestinationById(transferDestinationId));
public string? GetTransferDestinationJsonById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId)?.ToJson());
@ -92,13 +92,13 @@ namespace TIAM.Database.DataLayers.Admins
#region TransferDestinationToProduct
public TransferDestinationToProduct? GetTransferDestinationToProductById(Guid transferDestinationToProductId) => Session(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
public Task<TransferDestinationToProduct?> GetTransferDestinationToProductByIdAsync(Guid transferDestinationToProductId) => SessionAsync(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
public string? GetTransferDestinationToProductJsonById(Guid transferDestinationToProductId) => Session(ctx => ctx.GetTransferDestinationToProductById(transferDestinationToProductId)?.ToJson());
public TransferDestinationToProduct? GetTransferDestinationToProduct(Guid productId, Guid transferDestinationId) => Session(ctx=>ctx.GetTransferDestinationToProduct(productId, transferDestinationId));
public List<TransferDestinationToProduct>? GetTransferDestinationToProductsByProductId(Guid productId) => Session(ctx => ctx.GetTransferDestinationToProductsByProductId(productId));
public List<TransferDestinationToProduct>? GetTransferDestinationToProductsByTransferDestinationId(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationToProductsByTransferDestinationId(transferDestinationId));
public Task<List<TransferDestinationToProduct>> GetTransferDestinationToProducts() => SessionAsync(ctx=>ctx.GetTransferDestinationToProducts().ToList());
public Task<List<TransferDestinationToProduct>> GetTransferDestinationToProductsByProductId(Guid productId) => SessionAsync(ctx=>ctx.GetTransferDestinationToProductsByProductId(productId).ToList());
public Task<List<TransferDestinationToProduct>> GetTransferDestinationToProductsByTransferDestinationId(Guid transferDestinationId) => SessionAsync(ctx=>ctx.GetTransferDestinationToProductsByTransferDestinationId(transferDestinationId).ToList());
public string? GetTransferDestinationToProductJson(Guid productId, Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationToProduct(productId, transferDestinationId)?.ToJson());
public Task<bool> AddTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.AddTransferDestinationToProduct(transferDestinationToProduct));

View File

@ -65,11 +65,14 @@ public static class TransferDbSetExtensions
public static TransferDestinationToProduct? GetTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, Guid productId, Guid transferDestinationId)
=> ctx.TransferDestinationToProducts.FirstOrDefault(x => x.ProductId == productId && x.TransferDestinationId == transferDestinationId);
public static List<TransferDestinationToProduct>? GetTransferDestinationToProductsByProductId(this ITransferDestinationToProductDbSet ctx, Guid productId)
=> ctx.TransferDestinationToProducts.Where(x => x.ProductId == productId).ToList();
public static IQueryable<TransferDestinationToProduct> GetTransferDestinationToProducts(this ITransferDestinationToProductDbSet ctx)
=> ctx.TransferDestinationToProducts;
public static List<TransferDestinationToProduct>? GetTransferDestinationToProductsByTransferDestinationId(this ITransferDestinationToProductDbSet ctx, Guid transferDestinationId)
=> ctx.TransferDestinationToProducts.Where(x => x.TransferDestinationId == transferDestinationId).ToList();
public static IQueryable<TransferDestinationToProduct> GetTransferDestinationToProductsByProductId(this ITransferDestinationToProductDbSet ctx, Guid productId)
=> ctx.TransferDestinationToProducts.Where(x => x.ProductId == productId);
public static IQueryable<TransferDestinationToProduct> GetTransferDestinationToProductsByTransferDestinationId(this ITransferDestinationToProductDbSet ctx, Guid transferDestinationId)
=> ctx.TransferDestinationToProducts.Where(x => x.TransferDestinationId == transferDestinationId);
public static bool AddTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, TransferDestinationToProduct transferDestinationToProduct)
=> ctx.TransferDestinationToProducts.Add(transferDestinationToProduct).State == EntityState.Added;

View File

@ -86,8 +86,9 @@ public class SignalRTags : AcSignalRTags
public const int CreateTransferDestinationToProduct = 90;
public const int UpdateTransferDestinationToProduct = 91;
public const int RemoveTransferDestinationToProduct = 92; //set permissions to 0
public const int GetAllTransferDestinationToProducts = 93;
public const int GetTransferDestinationToProductByProductId = 94;
public const int GetTransferDestinationToProductByTransferDestinationId = 95;
public const int GetTransferDestinationToProductById = 93;
public const int GetAllTransferDestinationToProducts = 94;
public const int GetTransferDestinationToProductsByProductId = 95;
public const int GetTransferDestinationToProductsByTransferDestinationId = 96;
}

View File

@ -31,7 +31,7 @@
IconCssClass="btn-column-chooser"
Click="ColumnChooserButton_Click" />
</div>
<ProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllProducts"></ProductGridComponent>
<ProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto"></ProductGridComponent>
</div>

View File

@ -23,8 +23,6 @@
<ProductGrid @ref="_productGrid"
DataSource="ParentData?.Products ?? []"
GetAllMessageTag="GetAllTag"
Logger="_logger"
SignalRClient="AdminSignalRClient"
OnGridEditModelSaving="DataItemSaving"
@ -51,7 +49,7 @@
<DetailRowTemplate>
<DxTabs>
<DxTabPage Text="Prices">
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductByProductId" ContextIds="new [] {((Product)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductsByProductId" ContextIds="new [] {((Product)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
</DxTabPage>
<DxTabPage Text="Permissions">
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new[] { ((Product)context.DataItem).Id }" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
@ -89,9 +87,7 @@
@code {
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
private ProductGrid _productGrid = null!;

View File

@ -54,38 +54,38 @@
<DetailRowTemplate>
<DxTabs>
<DxTabPage Text="Prices">
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductByTransferDestinationId" ContextIds="new [] {((TransferDestination)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductsByTransferDestinationId" ContextIds="new [] {((TransferDestination)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
</DxTabPage>
</DxTabs>
</DetailRowTemplate>
<EditFormTemplate Context="EditFormContext">
<EditFormTemplate Context="editFormContext">
@{
var transfer = (TransferDestination)EditFormContext.EditModel;
var transfer = (TransferDestination)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanMd="6">
@EditFormContext.GetEditor("Name")
@editFormContext.GetEditor("Name")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Destination) ColSpanMd="6">
@EditFormContext.GetEditor("Description")
@editFormContext.GetEditor("Description")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@EditFormContext.GetEditor("AddressString")
@editFormContext.GetEditor("AddressString")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
@EditFormContext.GetEditor("Price")
@editFormContext.GetEditor("Price")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
@EditFormContext.GetEditor("Price2")
@editFormContext.GetEditor("Price2")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
@EditFormContext.GetEditor("Price3")
@editFormContext.GetEditor("Price3")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
@EditFormContext.GetEditor("ProductCommis")
@editFormContext.GetEditor("ProductCommis")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
@EditFormContext.GetEditor("ExtraPrice")
@editFormContext.GetEditor("ExtraPrice")
</DxFormLayoutItem>
</DxFormLayout>

View File

@ -10,6 +10,7 @@
@using AyCode.Services.Loggers
@using TIAM.Core.Loggers
@using AyCode.Core
@using TIAM.Services
@using TIAMSharedUI.Shared.Components.Grids
@inject IServiceProviderDataService ServiceProviderDataService
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@ -19,17 +20,17 @@
Logger="_logger"
SignalRClient="AdminSignalRClient"
ContextIds="ContextIds"
PageSize="5"
AutoExpandAllGroupRows="true"
GetAllMessageTag="GetAllTag"
PageSize="10"
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
KeyFieldName="Id"
ValidationEnabled="false"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
ShowFilterRow="true">
ColumnResizeMode="GridColumnResizeMode.NextColumn">
<Columns>
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
<DxGridDataColumn FieldName="ProductId" />
<DxGridDataColumn FieldName="TransferDestinationId"/>
<DxGridDataColumn FieldName="Price" />
@ -48,23 +49,23 @@
</DetailRowTemplate>
<EditFormTemplate Context="EditFormContext">
<EditFormTemplate Context="editFormContext">
@{
var serviceProvider = (Company)EditFormContext.EditModel;
var serviceProvider = (Company)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption="Price" ColSpanMd="4">
@EditFormContext.GetEditor("Price")
@editFormContext.GetEditor("Price")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Price2" ColSpanMd="4">
@EditFormContext.GetEditor("Price2")
@editFormContext.GetEditor("Price2")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Price3" ColSpanMd="4">
@EditFormContext.GetEditor("Price3")
@editFormContext.GetEditor("Price3")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
@EditFormContext.GetEditor("ProductCommis")
@editFormContext.GetEditor("ProductCommis")
</DxFormLayoutItem>
@ -77,70 +78,15 @@
@code {
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
[Parameter] public Guid? ContextId { get; set; }
[Parameter] public Guid[]? ContextIds { get; set; } = new Guid[0];
[Parameter] public int GetAllTag { get; set; }
[Parameter] public Guid[]? ContextIds { get; set; } = null!;
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllTransferDestinationToProducts;
private LoggerClient<TransferDestinationToProductGridComponent> _logger = null!;
protected override async Task OnInitializedAsync()
protected override void OnInitialized()
{
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
//_detailGridData = UserModelDtoDetail.ServiceProviders ?? [];
//_availableServices = await ServiceProviderDataService.GetServiceProvidersAsync();
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
base.OnInitialized();
}
protected override void OnParametersSet()
{
if(ContextId.HasValue)
{
ContextIds = new Guid[1];
ContextIds[0] = (Guid)ContextId!;
}
base.OnParametersSet();
}
// void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
// {
// if (!e.IsNew) return;
// var newProductMapping = new UserProductMapping
// {
// ProductId = Guid.NewGuid(),
// UserId = UserModelDtoDetail.Id,
// Permissions = 1
// };
// e.EditModel = newProductMapping;
// }
// async Task EditModelSaving(GridEditModelSavingEventArgs e)
// {
// if (e.IsNew)
// //add new orderData to orderData array
// _logger.Info("New orderData added");
// else
// _logger.Info("orderData updated");
// await UpdateDataAsync();
// }
// async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
// {
// //remove orderData from orderData array
// _logger.Info("orderData deleted");
// //await UpdateDataAsync();
// }
// async Task UpdateDataAsync()
// {
// //refresh grid
// _logger.Info("orderData grid refreshed");
// }
}

View File

@ -8,7 +8,7 @@ public class ProductGrid : TiamGrid<Product>
{
public ProductGrid() : base()
{
GetAllMessageTag = SignalRTags.GetProductsByContextId;
GetAllMessageTag = SignalRTags.GetAllProducts;
AddMessageTag = SignalRTags.AddProduct;
UpdateMessageTag = SignalRTags.UpdateProduct;
RemoveMessageTag = SignalRTags.RemoveProduct;

View File

@ -277,6 +277,99 @@ namespace TIAMWebApp.Server.Controllers
//}
//[AllowAnonymous]
//[HttpGet]
//[Route(APIUrls.GetTransferDestinationsRouteName)]
[SignalR(SignalRTags.GetAllTransferDestinationToProducts)]
public async Task<List<TransferDestinationToProduct>> GetAllTransferDestinationToProducts()
{
return await _adminDal.GetTransferDestinationToProducts();
}
//[AllowAnonymous]
//[HttpGet]
//[Route(APIUrls.GetTransferDestinationsRouteName)]
[SignalR(SignalRTags.GetTransferDestinationToProductsByProductId)]
public async Task<List<TransferDestinationToProduct>> GetTransferDestinationToProductsByProductId(Guid productId)
{
return await _adminDal.GetTransferDestinationToProductsByProductId(productId);
}
//[AllowAnonymous]
//[HttpGet]
//[Route(APIUrls.GetTransferDestinationsRouteName)]
[SignalR(SignalRTags.GetTransferDestinationToProductsByTransferDestinationId)]
public async Task<List<TransferDestinationToProduct>> GetTransferDestinationToProductsByTransferDestinationId(Guid transferDestinationId)
{
return await _adminDal.GetTransferDestinationToProductsByTransferDestinationId(transferDestinationId);
}
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.GetTransferDestinationToProductById)]
public async Task<TransferDestinationToProduct?> GetTransferDestinationToProductById(Guid transferDestinationToProductId)
{
var transferDestination = await _adminDal.GetTransferDestinationToProductByIdAsync(transferDestinationToProductId);
return transferDestination;
}
[AllowAnonymous]
[HttpPost]
[Route(APIUrls.CreateTransferDestinationRouteName)]
[SignalR(SignalRTags.CreateTransferDestinationToProduct)]
public async Task<TransferDestinationToProduct?> CreateTransferDestinationToProduct([FromBody] TransferDestinationToProduct transferDestinationToProduct)
{
_logger.Info(@"CreateTransferDestination called!");
var isSuccess = false;
if (transferDestinationToProduct.ProductId.IsNullOrEmpty() || transferDestinationToProduct.TransferDestinationId.IsNullOrEmpty())
{
var logText = $"transferDestinationToProduct.ProductId.IsNullOrEmpty() || transferDestinationToProduct.TransferDestinationId.IsNullOrEmpty(); ProductId: {transferDestinationToProduct.ProductId}; TransferDestinationId: {transferDestinationToProduct.TransferDestinationId}";
_logger.Error(logText);
}
else
{
if (transferDestinationToProduct.Id.IsNullOrEmpty()) transferDestinationToProduct.Id = Guid.NewGuid();
isSuccess = await _adminDal.AddTransferDestinationToProductAsync(transferDestinationToProduct);
}
return isSuccess ? transferDestinationToProduct : null;
}
//[AllowAnonymous]
//[HttpPost]
//[Route(APIUrls.UpdateTransferDestinationRouteName)]
[SignalR(SignalRTags.UpdateTransferDestinationToProduct)]
public async Task<TransferDestinationToProduct?> UpdateTransferDestinationToProduct([FromBody] TransferDestinationToProduct transferDestinationToProduct)
{
_logger.Info(@"UpdateTransferDestination called!");
var isSuccess = false;
if (transferDestinationToProduct.Id.IsNullOrEmpty() || transferDestinationToProduct.ProductId.IsNullOrEmpty() || transferDestinationToProduct.TransferDestinationId.IsNullOrEmpty())
{
var logText = $"transferDestinationToProduct.Id.IsNullOrEmpty() || transferDestinationToProduct.ProductId.IsNullOrEmpty() || transferDestinationToProduct.TransferDestinationId.IsNullOrEmpty(); Id: {transferDestinationToProduct.Id}; ProductId: {transferDestinationToProduct.ProductId}; TransferDestinationId: {transferDestinationToProduct.TransferDestinationId}";
_logger.Error(logText);
}
else isSuccess = await _adminDal.UpdateTransferDestinationToProductAsync(transferDestinationToProduct);
return isSuccess ? transferDestinationToProduct : null;
}
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.RemoveTransferDestinationToProduct)]
public async Task<TransferDestinationToProduct?> RemoveTransferDestinationToProduct([FromBody] TransferDestinationToProduct transferDestinationToProduct)
{
var result = await _adminDal.RemoveTransferDestinationToProductAsync(transferDestinationToProduct);
return result ? transferDestinationToProduct : null;
}
[AllowAnonymous]
[HttpPost]
[Route(APIUrls.CreateTransferRouteName)]

View File

@ -141,42 +141,48 @@ namespace Tiam.Services.Client.Tests
}
[DataTestMethod]
[DataRow(["cfb27fc2-54c2-4f07-8471-587d6b79b019", "7385c4e3-3c1e-4c5e-9926-8c0ea60dcb38"])]
public async Task TransferDestinationToProductCrudTest(string[] transferDestIdAddressIdStrings)
[DataRow(["e7528722-355a-4f8b-8571-7d7abf7ee109", "273EFE3C-D19F-4C2A-BF19-7397DC835C60", "05C147F8-8A87-47DD-BE1D-64EDA7A6A612"])]
public async Task TransferDestinationToProductCrudTest(string[] transferDestinationToProductIdTransferDestIdProductIdStrings)
{
var transferDestId = Guid.Parse(transferDestIdAddressIdStrings[0]);
var addressId = Guid.Parse(transferDestIdAddressIdStrings[1]);
var transferDestinationToProductId = Guid.Parse(transferDestinationToProductIdTransferDestIdProductIdStrings[0]);
var transferDestId = Guid.Parse(transferDestinationToProductIdTransferDestIdProductIdStrings[1]);
var productId = Guid.Parse(transferDestinationToProductIdTransferDestIdProductIdStrings[2]);
var transferDest = TestHelper.CreateTransferDestination(transferDestId, addressId);
var transferDestinationToProduct = TestHelper.CreateTransferDestinationToProduct(transferDestinationToProductId, transferDestId, productId);
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDest);
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDestinationToProduct);
transferDest = await _signalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDest);
Assert.IsNotNull(transferDest);
transferDestinationToProduct = await _signalRClient.PostDataAsync(SignalRTags.CreateTransferDestinationToProduct, transferDestinationToProduct);
Assert.IsNotNull(transferDestinationToProduct);
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
transferDestinationToProduct = await _signalRClient.GetByIdAsync<TransferDestinationToProduct>(SignalRTags.GetTransferDestinationToProductById, transferDestinationToProductId);
Assert.IsNotNull(transferDest);
Assert.IsNotNull(transferDest.Address);
Assert.IsNotNull(transferDestinationToProduct);
Assert.IsNotNull(transferDestinationToProduct.TransferDestination);
var modifiedAddress = "modified; " + transferDest.Address.AddressText;
transferDestinationToProduct.Price = 20000;
transferDestinationToProduct = await _signalRClient.PostDataAsync(SignalRTags.UpdateTransferDestinationToProduct, transferDestinationToProduct);
transferDest.Price = 20000;
transferDest.Address.AddressText = modifiedAddress;
Assert.IsNotNull(transferDestinationToProduct);
Assert.IsNotNull(transferDestinationToProduct.TransferDestination);
transferDest = await _signalRClient.PostDataAsync(SignalRTags.UpdateTransferDestination, transferDest);
Assert.IsTrue((int)transferDestinationToProduct.Price == 20000);
Assert.IsTrue(transferDestinationToProduct.Id == transferDestinationToProductId, "transferDestinationToProduct.Id != transferDestinationToProductId");
Assert.IsNotNull(transferDest);
Assert.IsNotNull(transferDest.Address);
var transferDestinationToProducts = await _signalRClient.GetByIdAsync<List<TransferDestinationToProduct>>(SignalRTags.GetTransferDestinationToProductsByTransferDestinationId, transferDestId);
Assert.IsNotNull(transferDestinationToProducts);
Assert.IsTrue(transferDestinationToProducts.Count > 0);
Assert.IsTrue(transferDestinationToProducts.All(x=>x.TransferDestinationId == transferDestId));
Assert.IsTrue((int)transferDest.Price == 20000);
Assert.IsTrue(transferDest.Address.AddressText == modifiedAddress);
Assert.IsTrue(transferDest.Id == transferDestId, "transferDest.Id != transferDestId");
transferDestinationToProducts = await _signalRClient.GetByIdAsync<List<TransferDestinationToProduct>>(SignalRTags.GetTransferDestinationToProductsByProductId, productId);
Assert.IsNotNull(transferDestinationToProducts);
Assert.IsTrue(transferDestinationToProducts.Count > 0);
Assert.IsTrue(transferDestinationToProducts.All(x=>x.ProductId == productId));
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestination, transferDest); //mielõbb kitöröljük, h ne maradjon szemét a db-ben - J.
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDestinationToProduct); //mielõbb kitöröljük, h ne maradjon szemét a db-ben - J.
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
Assert.IsNull(transferDest); //a korábbi törlés miatt NULL kell legyen - J.
transferDestinationToProduct = await _signalRClient.GetByIdAsync<TransferDestinationToProduct>(SignalRTags.GetTransferDestinationToProductById, transferDestinationToProductId);
Assert.IsNull(transferDestinationToProduct); //a korábbi törlés miatt NULL kell legyen - J.
}
}
}