| 123456789101112131415161718192021222324 |
- using Application.Abstractions.Data;
- using Application.Abstractions.Messaging;
- using Microsoft.EntityFrameworkCore;
- using SharedKernel.Results;
- namespace Application.Features.Admin.Store.GameCatalog.Delete;
- internal sealed class Handler(IAppDbContext db) : ICommandHandler<Command, Result>
- {
- public async Task<Result> Handle(Command request, CancellationToken ct)
- {
- var row = await db.GameProductCatalog.FirstOrDefaultAsync(c => c.ID == request.ID, ct);
- if (row is null)
- {
- return Result.Failure(Error.NotFound("GameCatalog.NotFound", "카탈로그 항목을 찾을 수 없습니다."));
- }
- db.GameProductCatalog.Remove(row);
- await db.SaveChangesAsync(ct);
- return Result.Success();
- }
- }
|