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.Common.Types/Common.Types/Countries/CountryService.cs

57 lines
1.4 KiB

2 years ago
using Common.Types.Security;
using Connected.ServiceModel;
using Connected.Services;
using Connected.Services.Annotations;
using System.Collections.Immutable;
namespace Common.Types.Countries;
internal sealed class CountryService : EntityService<int>, ICountryService
{
public CountryService(IContext context) : base(context)
{
}
[ServiceAuthorization(Claims.Delete)]
public async Task Delete(PrimaryKeyArgs<int> args)
{
await Invoke(GetOperation<DeleteCountry>(), args);
}
[ServiceAuthorization(Claims.Add)]
public async Task<int> Insert(InsertCountryArgs args)
{
return await Invoke(GetOperation<InsertCountry>(), args);
}
[ServiceAuthorization(Claims.Read)]
public async Task<ImmutableList<ICountry>?> Query()
{
return await Invoke(GetOperation<QueryCountries>(), Dto.Empty);
}
[ServiceAuthorization(Claims.Read)]
public async Task<ImmutableList<ICountry>?> Query(PrimaryKeyListArgs<int> args)
{
return await Invoke(GetOperation<LookupCountries>(), args);
}
[ServiceAuthorization(Claims.Read)]
public async Task<ICountry?> Select(PrimaryKeyArgs<int> args)
{
return await Invoke(GetOperation<SelectCountry>(), args);
}
[ServiceAuthorization(Claims.Read)]
public async Task<ICountry?> Select(NameArgs args)
{
return await Invoke(GetOperation<SelectCountryByName>(), args);
}
[ServiceAuthorization(Claims.Modify)]
public async Task Update(UpdateCountryArgs args)
{
await Invoke(GetOperation<UpdateCountry>(), args);
}
}