feat(sales): incorporar servicio UI para consumo de Delivery Note #26
@ -7,6 +7,7 @@ using phronCare.UIBlazor;
|
|||||||
using phronCare.UIBlazor.Services.Authorization;
|
using phronCare.UIBlazor.Services.Authorization;
|
||||||
using phronCare.UIBlazor.Services.Integrations;
|
using phronCare.UIBlazor.Services.Integrations;
|
||||||
using phronCare.UIBlazor.Services.Lookups;
|
using phronCare.UIBlazor.Services.Lookups;
|
||||||
|
using phronCare.UIBlazor.Services.Sales.DeliveryNotes;
|
||||||
using phronCare.UIBlazor.Services.Sales;
|
using phronCare.UIBlazor.Services.Sales;
|
||||||
using phronCare.UIBlazor.Services.Sales.Quotes;
|
using phronCare.UIBlazor.Services.Sales.Quotes;
|
||||||
using phronCare.UIBlazor.Services.Stock;
|
using phronCare.UIBlazor.Services.Stock;
|
||||||
@ -56,6 +57,7 @@ static void InjectDependencies(WebAssemblyHostBuilder builder)
|
|||||||
builder.Services.AddScoped<IStockScanService, StockScanService>();
|
builder.Services.AddScoped<IStockScanService, StockScanService>();
|
||||||
builder.Services.AddScoped<IExpeditionService, ExpeditionService>();
|
builder.Services.AddScoped<IExpeditionService, ExpeditionService>();
|
||||||
builder.Services.AddScoped<IQuoteService,QuoteService>();
|
builder.Services.AddScoped<IQuoteService,QuoteService>();
|
||||||
|
builder.Services.AddScoped<IDeliveryNoteService, DeliveryNoteService>();
|
||||||
|
|
||||||
builder.Services.AddScoped<ExchangeRateService>();
|
builder.Services.AddScoped<ExchangeRateService>();
|
||||||
builder.Services.AddScoped<TicketsService>();
|
builder.Services.AddScoped<TicketsService>();
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
using Domain.Dtos.Sales;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
|
||||||
|
namespace phronCare.UIBlazor.Services.Sales.DeliveryNotes
|
||||||
|
{
|
||||||
|
public class DeliveryNoteService : IDeliveryNoteService
|
||||||
|
{
|
||||||
|
private readonly HttpClient _http;
|
||||||
|
|
||||||
|
public DeliveryNoteService(HttpClient http)
|
||||||
|
{
|
||||||
|
_http = http;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<DeliveryNoteDto?> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _http.GetFromJsonAsync<DeliveryNoteDto>($"/api/deliverynote/{id}");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<DeliveryNoteDto?> GetByDeliveryNoteNumberAsync(string deliveryNoteNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _http.GetFromJsonAsync<DeliveryNoteDto>($"/api/deliverynote/number/{Uri.EscapeDataString(deliveryNoteNumber)}");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<DeliveryNoteDto>> GetByQuoteIdAsync(int quoteId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _http.GetFromJsonAsync<IEnumerable<DeliveryNoteDto>>($"/api/deliverynote/by-quote/{quoteId}") ?? Enumerable.Empty<DeliveryNoteDto>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<DeliveryNoteDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
using Domain.Dtos.Sales;
|
||||||
|
|
||||||
|
namespace phronCare.UIBlazor.Services.Sales.DeliveryNotes
|
||||||
|
{
|
||||||
|
public interface IDeliveryNoteService
|
||||||
|
{
|
||||||
|
Task<DeliveryNoteDto?> GetByIdAsync(int id);
|
||||||
|
Task<DeliveryNoteDto?> GetByDeliveryNoteNumberAsync(string deliveryNoteNumber);
|
||||||
|
Task<IEnumerable<DeliveryNoteDto>> GetByQuoteIdAsync(int quoteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user