Updated [Obsolete] attribute messages across several commands, handlers, and the mapping profile to clarify that related procedures or views should be used instead. Added [Obsolete] to CreateOutResCommand. No functional changes made.
26 lines
945 B
C#
26 lines
945 B
C#
using DigitalData.Core.Abstraction.Application.Repository;
|
|
using DigitalData.Core.Exceptions;
|
|
using MediatR;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using ReC.Domain.Entities;
|
|
|
|
namespace ReC.Application.RecActions.Commands;
|
|
|
|
[Obsolete("Use the related procedure or view.")]
|
|
public class DeleteRecActionsCommand : IRequest
|
|
{
|
|
public required long ProfileId { get; init; }
|
|
}
|
|
|
|
[Obsolete("Use the related procedure or view.")]
|
|
public class DeleteRecActionsCommandHandler(IRepository<RecAction> repo) : IRequestHandler<DeleteRecActionsCommand>
|
|
{
|
|
public async Task Handle(DeleteRecActionsCommand request, CancellationToken cancel)
|
|
{
|
|
// TODO: update DeleteAsync (in Core) to return number of deleted records
|
|
if (!await repo.Where(act => act.ProfileId == request.ProfileId).AnyAsync(cancel))
|
|
throw new NotFoundException();
|
|
|
|
await repo.DeleteAsync(act => act.ProfileId == request.ProfileId, cancel);
|
|
}
|
|
} |