initial commit

This commit is contained in:
2026-07-21 14:28:43 +07:00
commit 01107db6fd
995 changed files with 75124 additions and 0 deletions
@@ -0,0 +1,43 @@
using Indotalent.Infrastructure.Database;
using MediatR;
namespace Indotalent.Features.Utilities.ProgramResource.Cqrs;
public class CreateProgramResourceRequest
{
public string? Name { get; set; }
public string? Description { get; set; }
}
public class CreateProgramResourceResponse
{
public string? Id { get; set; }
public string? Name { get; set; }
}
public record CreateProgramResourceCommand(CreateProgramResourceRequest Data) : IRequest<CreateProgramResourceResponse>;
public class CreateProgramResourceHandler : IRequestHandler<CreateProgramResourceCommand, CreateProgramResourceResponse>
{
private readonly AppDbContext _context;
public CreateProgramResourceHandler(AppDbContext context) => _context = context;
public async Task<CreateProgramResourceResponse> Handle(CreateProgramResourceCommand request, CancellationToken cancellationToken)
{
var entity = new Data.Entities.ProgramManagerResource
{
Name = request.Data.Name,
Description = request.Data.Description
};
_context.ProgramManagerResource.Add(entity);
await _context.SaveChangesAsync(cancellationToken);
return new CreateProgramResourceResponse
{
Id = entity.Id,
Name = entity.Name
};
}
}