Products
This commit is contained in:
parent
4742a37610
commit
8651b52dae
|
|
@ -80,6 +80,25 @@ namespace TIAM.Database.Test
|
||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DataTestMethod]
|
||||||
|
public void GetProducts_ReturnProducts_WhenProductsExist()
|
||||||
|
{
|
||||||
|
var products = JsonConvert.DeserializeObject<IEnumerable<Product>>(Dal.GetProducts());
|
||||||
|
Assert.IsNotNull(products, "Products is null");
|
||||||
|
Assert.IsTrue(products.Count() > 0, "No products found");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[DataTestMethod]
|
||||||
|
[DataRow("3587F169-683C-4EEE-BCB5-E8D57F8C6DCE")]
|
||||||
|
public void GetProductsByServiceProviderId_ReturnProducts_WhenProductsExist(string serviceProviderId)
|
||||||
|
{
|
||||||
|
var products = JsonConvert.DeserializeObject<IEnumerable<Product>>(Dal.GetProductsByServiceProviderId(Guid.Parse(serviceProviderId)));
|
||||||
|
Assert.IsNotNull(products, "Products is null");
|
||||||
|
Assert.IsTrue(products.Count() > 0, "No products found");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow("814b5495-c2e9-4f1d-a73f-37cd5d353078")]
|
[DataRow("814b5495-c2e9-4f1d-a73f-37cd5d353078")]
|
||||||
public void GeProductById_ReturnsProduct_WhenHasUserProductMappingRelation(string productIdString)
|
public void GeProductById_ReturnsProduct_WhenHasUserProductMappingRelation(string productIdString)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public string GetUsersJson() => Session(ctx => ctx.Users.ToJson());
|
public string GetUsersJson() => Session(ctx => ctx.Users.ToJson());
|
||||||
|
|
||||||
public Product? GetProductById(Guid contextId) => Session(ctx => ctx.GetProductById(contextId));
|
public Product? GetProductById(Guid contextId) => Session(ctx => ctx.GetProductById(contextId));
|
||||||
|
public string GetProducts() => Session(ctx => ctx.Products.ToJson());
|
||||||
|
public string GetProductsByServiceProviderId(Guid serviceProviderId) => Session(ctx => ctx.Products.Where(x => x.ServiceProviderId == serviceProviderId).ToJson());
|
||||||
public Task<bool> AddProduct(Product product) => TransactionAsync(ctx => ctx.AddProduct(product) && ctx.SaveChanges() > 0);
|
public Task<bool> AddProduct(Product product) => TransactionAsync(ctx => ctx.AddProduct(product) && ctx.SaveChanges() > 0);
|
||||||
|
|
||||||
public Task<bool> UpdateProduct(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product) && ctx.SaveChanges() > 0);
|
public Task<bool> UpdateProduct(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product) && ctx.SaveChanges() > 0);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,13 @@ public class Product : ProductBase
|
||||||
|
|
||||||
public Product(Guid ownerId, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, productType, name, description, price, jsonDetails) { }
|
public Product(Guid ownerId, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, productType, name, description, price, jsonDetails) { }
|
||||||
public Product(Guid id, Guid serviceProviderId, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
|
public Product(Guid id, Guid serviceProviderId, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
|
||||||
|
{
|
||||||
|
ServiceProviderId = serviceProviderId;
|
||||||
|
}
|
||||||
|
public Product(Guid ownerId, TiamServiceProvider serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, serviceProvider, productType, name, description, price, jsonDetails) { }
|
||||||
|
public Product(Guid id, Guid serviceProviderId, TiamServiceProvider serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
|
||||||
{
|
{
|
||||||
ServiceProviderId = serviceProviderId;
|
ServiceProviderId = serviceProviderId;
|
||||||
|
ServiceProvider = serviceProvider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@page "/user/destinations"
|
@page "/user/products"
|
||||||
@using AyCode.Models.Messages
|
@using AyCode.Models.Messages
|
||||||
@using TIAM.Entities.ServiceProviders
|
@using TIAM.Entities.ServiceProviders
|
||||||
@using TIAM.Resources
|
@using TIAM.Resources
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="Id" MinWidth="80" Width="20%" Visible="false" />
|
<DxGridDataColumn FieldName="Id" MinWidth="80" Width="20%" Visible="false" />
|
||||||
|
<DxGridDataColumn FieldName="ServiceProviderId" MinWidth="80" Width="20%" Visible="false" />
|
||||||
<DxGridDataColumn FieldName="Name" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%">
|
<DxGridDataColumn FieldName="Name" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
@{
|
@{
|
||||||
|
|
@ -57,8 +58,8 @@
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
<DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
|
<DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
|
||||||
<DxGridDataColumn FieldName="AddressString" MinWidth="80" Width="20%" />
|
|
||||||
<DxGridDataColumn FieldName="Price" MinWidth="80" Width="20%" />
|
<DxGridDataColumn FieldName="Price" MinWidth="80" Width="20%" />
|
||||||
|
<DxGridDataColumn FieldName="JsonDetails" MinWidth="80" Width="20%" />
|
||||||
|
|
||||||
|
|
||||||
</Columns>
|
</Columns>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using TIAM.Entities.TransferDestinations;
|
using TIAM.Entities.ServiceProviders;
|
||||||
using TIAM.Core.Enums;
|
using TIAM.Core.Enums;
|
||||||
|
using TIAMWebApp.Shared.Application.Services;
|
||||||
|
|
||||||
namespace TIAMSharedUI.Pages.User.SysAdmins
|
namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
{
|
{
|
||||||
|
|
@ -25,14 +26,14 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
public MessageWizardModel messageWizardModel = new MessageWizardModel();
|
public MessageWizardModel messageWizardModel = new MessageWizardModel();
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public ITransferDataService transferDataService { get; set; }
|
public IServiceProviderDataService serviceProviderDataService { get; set; }
|
||||||
|
|
||||||
|
|
||||||
object? ProductArray = new ProductWizardModel[]
|
object? ProductArray = new ProductWizardModel[]
|
||||||
{
|
{
|
||||||
new ProductWizardModel(ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
new ProductWizardModel(new TiamServiceProvider(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
||||||
new ProductWizardModel(ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
new ProductWizardModel(new TiamServiceProvider(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
||||||
new ProductWizardModel(ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
new ProductWizardModel(new TiamServiceProvider(), ProductType.Hotel, "XY hotel", "XYHotel description is here ", 10.0f, ""),
|
||||||
};
|
};
|
||||||
|
|
||||||
object? TransferDataFromDb = new ProductWizardModel[] { };
|
object? TransferDataFromDb = new ProductWizardModel[] { };
|
||||||
|
|
@ -146,13 +147,13 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
var a = await transferDataService.GetDestinationsAsync();
|
var a = await serviceProviderDataService.GetProductsForServiceProviderAsync(Guid.NewGuid());
|
||||||
logToBrowserConsole.LogToBC($"TransferDataFromDb: {((TransferDestinationWizardModel[])TransferDataFromDb).Length}");
|
logToBrowserConsole.LogToBC($"ProductDataFromDb: {((ProductWizardModel[])TransferDataFromDb).Length}");
|
||||||
foreach (var item in a)
|
foreach (var item in a)
|
||||||
{
|
{
|
||||||
//add new transferwizardmodel to transferData array
|
//add new transferwizardmodel to transferData array
|
||||||
TransferDataFromDb = ((TransferDestinationWizardModel[])TransferDataFromDb).Append(
|
TransferDataFromDb = ((ProductWizardModel[])TransferDataFromDb).Append(
|
||||||
new TransferDestinationWizardModel(Guid.NewGuid(), item.Name, item.Description, item.AddressString));
|
new ProductWizardModel(item.ServiceProvider, item.ProductType, item.Name, item.Description, item.Price, item.JsonDetails));
|
||||||
logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}");
|
logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,12 @@
|
||||||
|
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="user/properties">
|
<NavLink class="nav-link" href="user/properties">
|
||||||
Properties
|
My companies
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<NavLink class="nav-link" href="user/products">
|
||||||
|
Services
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
{
|
{
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:28749",
|
|
||||||
"sslPort": 44368
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"http": {
|
"http": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
|
||||||
"applicationUrl": "http://localhost:5175",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"applicationUrl": "http://localhost:5175"
|
||||||
},
|
},
|
||||||
"https": {
|
"https": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
|
||||||
"applicationUrl": "https://localhost:7116;http://localhost:5175",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"applicationUrl": "https://localhost:7116;http://localhost:5175"
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:60505/",
|
||||||
|
"sslPort": 44395
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ using SkiaSharp;
|
||||||
using SkiaSharp.Views.Desktop;
|
using SkiaSharp.Views.Desktop;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.Net;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using TIAM.Database.DataLayers.Admins;
|
using TIAM.Database.DataLayers.Admins;
|
||||||
//using TIAM.Database.DataLayers.ServiceProviders;
|
//using TIAM.Database.DataLayers.ServiceProviders;
|
||||||
|
|
@ -124,8 +125,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
//22.
|
//22.
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.CreateUserProductMappingRouteName)]
|
[Route(APIUrls.CreateUserProductMappingRouteName)]
|
||||||
[Route("CreateUserProductMapping")]
|
|
||||||
[Tags("Finished", "ServiceProvider")]
|
[Tags("Finished", "ServiceProvider")]
|
||||||
[EndpointSummary("Create assigned user to product")]
|
[EndpointSummary("Create assigned user to product")]
|
||||||
public async Task<IActionResult> CreateUserProductMapping(CreateUserProductMappingModel createUserProductMappingModel)
|
public async Task<IActionResult> CreateUserProductMapping(CreateUserProductMappingModel createUserProductMappingModel)
|
||||||
|
|
@ -212,5 +212,35 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return Ok(sigBase64);
|
return Ok(sigBase64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
||||||
|
[Tags("In-Progress", "Product")]
|
||||||
|
public IActionResult GetProductsByServiceProviderId(Guid serviceProviderId)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
||||||
|
|
||||||
|
if (serviceProviderId == Guid.Empty)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid request");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var products = _adminDal.GetProductsByServiceProviderId(serviceProviderId);
|
||||||
|
if (products != null)
|
||||||
|
{
|
||||||
|
return Ok(products);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//some Iactionresult that explains that there were errors
|
||||||
|
return StatusCode(500);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,5 +52,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
||||||
//25. (IServiceProviderDataService) Get QRCode by ProductId
|
//25. (IServiceProviderDataService) Get QRCode by ProductId
|
||||||
public Task<string> GetQRCodeByProductIdAsync(Guid productId);
|
public Task<string> GetQRCodeByProductIdAsync(Guid productId);
|
||||||
|
|
||||||
|
public Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string AddProductRouteName = "AddProduct";
|
public const string AddProductRouteName = "AddProduct";
|
||||||
public const string AddProductRouteUrl = ServiceProviderAPI + AddProductRouteName;
|
public const string AddProductRouteUrl = ServiceProviderAPI + AddProductRouteName;
|
||||||
|
|
||||||
|
public const string GetProductsByServiceProviderIdRouteName = "GetProductsByServiceProviderId";
|
||||||
|
public const string GetProductsByServiceProviderId = ServiceProviderAPI + GetProductsByServiceProviderIdRouteName;
|
||||||
|
|
||||||
public const string CreateUserProductMappingRouteName = "CreateUserProductMapping";
|
public const string CreateUserProductMappingRouteName = "CreateUserProductMapping";
|
||||||
public const string CreateUserProductMapping = ServiceProviderAPI + CreateUserProductMappingRouteName;
|
public const string CreateUserProductMapping = ServiceProviderAPI + CreateUserProductMappingRouteName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TIAM.Core.Enums;
|
using TIAM.Core.Enums;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
using TIAM.Entities.ServiceProviders;
|
||||||
using TIAM.Resources;
|
using TIAM.Resources;
|
||||||
|
|
||||||
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
|
|
@ -29,21 +31,27 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
public float Price { get; set; }
|
public float Price { get; set; }
|
||||||
public string? JsonDetails { get; set; }
|
public string? JsonDetails { get; set; }
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
public TiamServiceProvider TiamServiceProvider { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
|
||||||
|
|
||||||
public ProductWizardModel() { }
|
public ProductWizardModel() { }
|
||||||
|
|
||||||
public ProductWizardModel(ProductType productType, string name, string description, float price, string? jsonDetails) : this(Guid.NewGuid(), productType, name, description, price, jsonDetails) { }
|
public ProductWizardModel(TiamServiceProvider tiamServiceProvider, ProductType productType, string name, string description, float price, string? jsonDetails) : this(Guid.NewGuid(), tiamServiceProvider, productType, name, description, price, jsonDetails) { }
|
||||||
|
|
||||||
public ProductWizardModel(Guid id, ProductType productType, string name, string description, float price, string? jsonDetails)
|
public ProductWizardModel(Guid id, TiamServiceProvider tiamServiceProvider, ProductType productType, string name, string description, float price, string? jsonDetails)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
TiamServiceProvider = tiamServiceProvider;
|
||||||
ProductType = productType;
|
ProductType = productType;
|
||||||
Name = name;
|
Name = name;
|
||||||
Description = description;
|
Description = description;
|
||||||
Price = price;
|
Price = price;
|
||||||
JsonDetails = jsonDetails;
|
JsonDetails = jsonDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Product SaveToProduct(TiamServiceProvider tiamServiceProvider)
|
||||||
|
{
|
||||||
|
Product NewProduct = new(this.Id, tiamServiceProvider.Id, tiamServiceProvider, this.ProductType, this.Name, this.Description, this.Price, this.JsonDetails);
|
||||||
|
return NewProduct;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using AyCode.Interfaces.StorageHandlers;
|
using AyCode.Interfaces.StorageHandlers;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using TIAM.Database.DataLayers.Users;
|
using TIAM.Database.DataLayers.Users;
|
||||||
|
|
@ -129,5 +130,28 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId)
|
||||||
|
{
|
||||||
|
var url = APIUrls.GetProductsByServiceProviderId;
|
||||||
|
var response = await http.PostAsJsonAsync(url, serviceProviderId);
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
|
logToBrowserConsole.LogToBC("Json: " + result);
|
||||||
|
var data = JsonConvert.DeserializeObject<IEnumerable<Product>>(result);
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue