#27 saveChanges
This commit is contained in:
@@ -27,6 +27,8 @@ public class CreateSessionCheckoutCommandHandler(
|
|||||||
|
|
||||||
await dbContext.UserTransactions.AddAsync(userTransaction, cancellationToken);
|
await dbContext.UserTransactions.AddAsync(userTransaction, cancellationToken);
|
||||||
|
|
||||||
|
await dbContext.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
return stripeSecret;
|
return stripeSecret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
using System.Security.Claims;
|
using Hutopy.Domain.Interfaces;
|
||||||
using Hutopy.Domain.Interfaces;
|
|
||||||
using Hutopy.Domain.Models;
|
using Hutopy.Domain.Models;
|
||||||
using Hutopy.Infrastructure.Identity;
|
using Hutopy.Infrastructure.Identity;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
namespace Hutopy.Infrastructure.Services;
|
namespace Hutopy.Infrastructure.Services;
|
||||||
|
|
||||||
public class UserService(UserManager<ApplicationUser> userManager, IHttpContextAccessor httpContextAccessor) : IUserService
|
public class UserService(UserManager<ApplicationUser> userManager) : IUserService
|
||||||
{
|
{
|
||||||
public async Task CreateUserAsync(string email, string userName, string firstName, string lastName, string password)
|
public async Task CreateUserAsync(string email, string userName, string firstName, string lastName, string password)
|
||||||
{
|
{
|
||||||
@@ -48,7 +46,8 @@ public class UserService(UserManager<ApplicationUser> userManager, IHttpContextA
|
|||||||
|
|
||||||
public async Task<UserModel?> GetCurrentUserAsync()
|
public async Task<UserModel?> GetCurrentUserAsync()
|
||||||
{
|
{
|
||||||
var userId = httpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
// todo: Get the id of the user doing the request.
|
||||||
|
var userId = "";
|
||||||
if (string.IsNullOrEmpty(userId))
|
if (string.IsNullOrEmpty(userId))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user