mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-22 09:18:08 +00:00
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Security.Claims;
|
|
using System.Threading.Tasks;
|
|
using AutoMapper;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using PodNoms.Api.Models;
|
|
using PodNoms.Api.Models.ViewModels;
|
|
using PodNoms.Api.Persistence;
|
|
using PodNoms.Api.Services.Auth;
|
|
|
|
namespace PodNoms.Api.Controllers {
|
|
[Authorize]
|
|
[Route("[controller]")]
|
|
public class ProfileController : BaseAuthController {
|
|
|
|
public IUnitOfWork _unitOfWork { get; }
|
|
|
|
|
|
public IMapper _mapper { get; }
|
|
|
|
public ProfileController(IMapper mapper, IUnitOfWork unitOfWork,
|
|
UserManager<ApplicationUser> userManager, IHttpContextAccessor contextAccessor)
|
|
: base(contextAccessor, userManager) {
|
|
this._mapper = mapper;
|
|
this._unitOfWork = unitOfWork;
|
|
}
|
|
[HttpGet]
|
|
public async Task<ActionResult<ProfileViewModel>> Get() {
|
|
var result = _mapper.Map<ApplicationUser, ProfileViewModel>(_applicationUser);
|
|
return new OkObjectResult(result);
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<ActionResult> Post([FromBody] ProfileViewModel item) {
|
|
throw new InvalidOperationException("THis has not been setup yet");
|
|
}
|
|
|
|
[HttpGet("checkslug/{slug}")]
|
|
public async Task<string> CheckSlug(string slug) {
|
|
return "NotFound";
|
|
}
|
|
}
|
|
} |