User profile service #2
4 changed files with 54 additions and 0 deletions
6
DrinkRateAPI/ApiModels/UserProfile/UserProfileGet.cs
Normal file
6
DrinkRateAPI/ApiModels/UserProfile/UserProfileGet.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DrinkRateAPI.ApiModels.UserProfile;
|
||||||
|
|
||||||
|
public class UserProfileGet
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
DrinkRateAPI/ApiModels/UserProfile/UserProfilePut.cs
Normal file
6
DrinkRateAPI/ApiModels/UserProfile/UserProfilePut.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DrinkRateAPI.ApiModels.UserProfile;
|
||||||
|
|
||||||
|
public class UserProfilePut
|
||||||
|
{
|
||||||
|
public string UserName { get; set; }
|
||||||
|
}
|
18
DrinkRateAPI/Controllers/UserProfileController.cs
Normal file
18
DrinkRateAPI/Controllers/UserProfileController.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Security.Claims;
|
||||||
|
using DrinkRateAPI.ApiModels.UserProfile;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace DrinkRateAPI.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("user_profile")]
|
||||||
|
public class UserProfileController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpPut(Name = "user_profile")]
|
||||||
|
public UserProfileGet PutUserProfile(UserProfilePut userProfile)
|
||||||
|
{
|
||||||
|
throw new ApplicationException();
|
||||||
|
var x = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; //HttpContext.User.Identities.First();
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
}
|
24
DrinkRateAPI/Services/UserProfileService.cs
Normal file
24
DrinkRateAPI/Services/UserProfileService.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using System.Security.Claims;
|
||||||
|
using DrinkRateAPI.ApiModels.UserProfile;
|
||||||
|
using DrinkRateAPI.Contexts;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
|
||||||
|
namespace DrinkRateAPI.Services;
|
||||||
|
|
||||||
|
public class UserProfileService(ApplicationDbContext context,
|
||||||
|
ApplicationUserService applicationUserService)
|
||||||
|
{
|
||||||
|
private ApplicationDbContext _context = context;
|
||||||
|
private ApplicationUserService _applicationUserService = applicationUserService;
|
||||||
|
|
||||||
|
public async Task<UserProfileGet> PutUserProfileAsync(UserProfilePut userProfile, ClaimsPrincipal identity)
|
||||||
|
{
|
||||||
|
var profile = _applicationUserService.UserProfileByApplicationUserAsync(identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue