as is
This commit is contained in:
@@ -150,7 +150,7 @@ public class UserService : IUserService
|
||||
|
||||
public async Task<ApiResponse> ChangePasswordAsync(ChangePasswordParams model)
|
||||
{
|
||||
int userId = _claimsService.GetCurrentUserId();
|
||||
int userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
var user = await _dbContext.Users
|
||||
.FirstAsync(u => u.Id == userId);
|
||||
|
||||
@@ -166,7 +166,7 @@ public class UserService : IUserService
|
||||
|
||||
public async Task<ApiResponse<User>> GetUserInfoAsync()
|
||||
{
|
||||
var userId = _claimsService.GetCurrentUserId();
|
||||
var userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
var model = await _dbContext.Users
|
||||
.FirstAsync(u => u.Id == userId);
|
||||
|
||||
@@ -187,7 +187,7 @@ public class UserService : IUserService
|
||||
|
||||
public async Task<ApiResponse> EditAsync(EditUserParams model)
|
||||
{
|
||||
int userId = _claimsService.GetCurrentUserId();
|
||||
int userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
var user = await _dbContext.Users.FirstAsync(u => u.Id == userId);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.AvatarFileName))
|
||||
@@ -205,7 +205,7 @@ public class UserService : IUserService
|
||||
|
||||
public ApiResponse<List<Address>> GetAddresses()
|
||||
{
|
||||
var userId = _claimsService.GetCurrentUserId();
|
||||
var userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
|
||||
var addresses = _dbContext.Addresses
|
||||
.Where(a => a.UserId == userId)
|
||||
@@ -221,7 +221,7 @@ public class UserService : IUserService
|
||||
{
|
||||
EF.Models.Address? address = null;
|
||||
|
||||
var userId = _claimsService.GetCurrentUserId();
|
||||
var userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
|
||||
if (model.Id.HasValue && model.Id > 0)
|
||||
{
|
||||
@@ -253,7 +253,7 @@ public class UserService : IUserService
|
||||
|
||||
public async Task<ApiResponse> DeleteAddressAsync(int id)
|
||||
{
|
||||
var userId = _claimsService.GetCurrentUserId();
|
||||
var userId = _claimsService.GetCurrentUserId()!.Value;
|
||||
await _dbContext.Addresses
|
||||
.Where(a => a.Id == id && a.UserId == userId)
|
||||
.ExecuteDeleteAsync();
|
||||
|
||||
Reference in New Issue
Block a user