using System.Dynamic; using Hutopy.Application.Common.Interfaces; using Hutopy.Domain.Interfaces; namespace Hutopy.Application.Users.Commands; public record CreateUserCommand : IRequest { public required string FirstName { get; init; } public required string LastName { get; init; } public required string EmailAddress { get; init; } public required string UserName { get; init; } public required string Password { get; init; } } public class CreateUserCommandHandler : IRequestHandler { private readonly IApplicationDbContext _context; private readonly IUserService _userService; public CreateUserCommandHandler(IApplicationDbContext context, IUserService userService) { _context = context; _userService = userService; } public async Task Handle(CreateUserCommand request, CancellationToken cancellationToken) { // Dont really need the handler for the create. The get will work like this : var user = await _userService.FindUserByIdAsync("072ae7d5-8c4a-4a0f-b250-7d39941125cb"); // var user2 = await _userService.FindUserByEmailAsync("test10@hotmail.com"); var tt = user?.FirstName; await _context.SaveChangesAsync(cancellationToken); return Guid.NewGuid(); } }