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/Connected.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 = Connected.Logistics.Types.WarehouseLocations.WarehouseLocationOps;
2 years ago
namespace Connected.Logistics.Types.WarehouseLocations;
2 years ago
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);
}
}