Merge pull request 'feat(sales): incorporar servicio UI para consumo de Delivery Note' (#26) from feature/leandro/25-deliverynote-ui-service into master
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 14m42s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 14m42s
Reviewed-on: http://saludlab.com.ar:3000/leandro/phronCare/pulls/26
This commit is contained in:
commit
bb764b4d12
@ -7,6 +7,7 @@ using phronCare.UIBlazor;
|
||||
using phronCare.UIBlazor.Services.Authorization;
|
||||
using phronCare.UIBlazor.Services.Integrations;
|
||||
using phronCare.UIBlazor.Services.Lookups;
|
||||
using phronCare.UIBlazor.Services.Sales.DeliveryNotes;
|
||||
using phronCare.UIBlazor.Services.Sales;
|
||||
using phronCare.UIBlazor.Services.Sales.Quotes;
|
||||
using phronCare.UIBlazor.Services.Stock;
|
||||
@ -56,6 +57,7 @@ static void InjectDependencies(WebAssemblyHostBuilder builder)
|
||||
builder.Services.AddScoped<IStockScanService, StockScanService>();
|
||||
builder.Services.AddScoped<IExpeditionService, ExpeditionService>();
|
||||
builder.Services.AddScoped<IQuoteService,QuoteService>();
|
||||
builder.Services.AddScoped<IDeliveryNoteService, DeliveryNoteService>();
|
||||
|
||||
builder.Services.AddScoped<ExchangeRateService>();
|
||||
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