You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Logistics/Logistics.Types/WarehouseLocations/WarehouseLocationService.cs

67 lines
1.9 KiB

2 years ago
using System.Collections.Immutable;
using Connected.Entities;
using Connected.ServiceModel;
using Connected.Services;
using Ops = Logistics.Types.WarehouseLocations.WarehouseLocationOps;
namespace Logistics.Types.WarehouseLocations;
internal sealed class WarehouseLocationService : EntityService<int>, IWarehouseLocationService
{
public WarehouseLocationService(IContext context) : base(context)
{
}
public async Task Delete(PrimaryKeyArgs<int> args)
{
await Invoke(GetOperation<Ops.Delete>(), args);
}
public Task<int> Insert(InsertWarehouseLocationArgs args)
{
return Invoke(GetOperation<Ops.Insert>(), args);
}
public async Task Patch(PatchArgs<int> args)
{
if (await Select(args.Id) is not WarehouseLocation entity)
return;
await Update(args.Patch<UpdateWarehouseLocationArgs, WarehouseLocation>(entity));
}
public async Task<ImmutableList<IWarehouseLocation>> Query(QueryArgs? args)
{
return await Invoke(GetOperation<Ops.Query>(), args ?? QueryArgs.Default);
}
public async Task<ImmutableList<IWarehouseLocation>> Query(QueryWarehouseLocationArgs args)
{
return await Invoke(GetOperation<Ops.QueryByWarehouse>(), args);
}
public async Task<ImmutableList<IWarehouseLocation>> Query(PrimaryKeyListArgs<int> args)
{
return await Invoke(GetOperation<Ops.Lookup>(), args);
}
public async Task<ImmutableList<IWarehouseLocation>> QueryChildren(QueryWarehouseLocationChildrenArgs args)
{
return await Invoke(GetOperation<Ops.QueryChildren>(), args);
}
public async Task<IWarehouseLocation?> Select(PrimaryKeyArgs<int> args)
{
return await Invoke(GetOperation<Ops.Select>(), args);
}
public async Task<IWarehouseLocation?> Select(SelectWarehouseLocationArgs args)
{
return await Invoke(GetOperation<Ops.SelectByCode>(), args);
}
public async Task Update(UpdateWarehouseLocationArgs args)
{
await Invoke(GetOperation<Ops.Update>(), args);
}
}