Feature: Join us api call
This commit is contained in:
@@ -8,7 +8,7 @@ public interface IApplicationDbContext
|
||||
|
||||
DbSet<TodoItem> TodoItems { get; }
|
||||
|
||||
DbSet<FuturCreator> FuturCreators { get; }
|
||||
DbSet<FutureCreator> FutureCreators { get; }
|
||||
|
||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using Hutopy.Application.Common.Behaviours;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Hutopy.Application.Common.Interfaces;
|
||||
using Hutopy.Domain.Entities;
|
||||
|
||||
namespace Hutopy.Application.FuturCreators.Commands.CreateFuturCreator;
|
||||
namespace Hutopy.Application.FutureCreators.Commands;
|
||||
|
||||
public record CreateFuturCreatorCommand : IRequest<int>
|
||||
public record CreateFutureCreatorCommand : IRequest<int>
|
||||
{
|
||||
public required string FirstName { get; init; }
|
||||
public required string LastName { get; init; }
|
||||
@@ -13,7 +13,7 @@ public record CreateFuturCreatorCommand : IRequest<int>
|
||||
public required string ReasonToJoin { get; init; }
|
||||
}
|
||||
|
||||
public class CreateFuturCreatorCommandHandler : IRequestHandler<CreateFuturCreatorCommand, int>
|
||||
public class CreateFuturCreatorCommandHandler : IRequestHandler<CreateFutureCreatorCommand, int>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
|
||||
@@ -23,9 +23,9 @@ public class CreateFuturCreatorCommandHandler : IRequestHandler<CreateFuturCreat
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<int> Handle(CreateFuturCreatorCommand request, CancellationToken cancellationToken)
|
||||
public async Task<int> Handle(CreateFutureCreatorCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = new FuturCreator()
|
||||
var entity = new FutureCreator
|
||||
{
|
||||
FirstName = request.FirstName,
|
||||
LastName = request.LastName,
|
||||
@@ -35,7 +35,7 @@ public class CreateFuturCreatorCommandHandler : IRequestHandler<CreateFuturCreat
|
||||
ReasonToJoin = request.ReasonToJoin,
|
||||
};
|
||||
|
||||
_context.FuturCreators.Add(entity);
|
||||
_context.FutureCreators.Add(entity);
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user