diff options
Diffstat (limited to 'src/DevHive.Web/Controllers')
| -rw-r--r-- | src/DevHive.Web/Controllers/CommentController.cs | 83 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/FeedController.cs | 54 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/LanguageController.cs | 87 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/PostController.cs | 89 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/RateController.cs | 40 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/RoleController.cs | 77 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/TechnologyController.cs | 87 | ||||
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 140 |
8 files changed, 0 insertions, 657 deletions
diff --git a/src/DevHive.Web/Controllers/CommentController.cs b/src/DevHive.Web/Controllers/CommentController.cs deleted file mode 100644 index c38e300..0000000 --- a/src/DevHive.Web/Controllers/CommentController.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using AutoMapper; -using System; -using DevHive.Web.Models.Comment; -using DevHive.Services.Models.Comment; -using Microsoft.AspNetCore.Authorization; -using DevHive.Services.Interfaces; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - [Authorize(Roles = "User,Admin")] - public class CommentController - { - private readonly ICommentService _commentService; - private readonly IMapper _commentMapper; - - public CommentController(ICommentService commentService, IMapper commentMapper) - { - this._commentService = commentService; - this._commentMapper = commentMapper; - } - - [HttpPost] - public async Task<IActionResult> AddComment(Guid userId, [FromBody] CreateCommentWebModel createCommentWebModel, [FromHeader] string authorization) - { - if (!await this._commentService.ValidateJwtForCreating(userId, authorization)) - return new UnauthorizedResult(); - - CreateCommentServiceModel createCommentServiceModel = - this._commentMapper.Map<CreateCommentServiceModel>(createCommentWebModel); - createCommentServiceModel.CreatorId = userId; - - Guid id = await this._commentService.AddComment(createCommentServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult("Could not create comment!") : - new OkObjectResult(new { Id = id }); - } - - [HttpGet] - [AllowAnonymous] - public async Task<IActionResult> GetCommentById(Guid id) - { - ReadCommentServiceModel readCommentServiceModel = await this._commentService.GetCommentById(id); - ReadCommentWebModel readCommentWebModel = this._commentMapper.Map<ReadCommentWebModel>(readCommentServiceModel); - - return new OkObjectResult(readCommentWebModel); - } - - [HttpPut] - public async Task<IActionResult> UpdateComment(Guid userId, [FromBody] UpdateCommentWebModel updateCommentWebModel, [FromHeader] string authorization) - { - if (!await this._commentService.ValidateJwtForComment(updateCommentWebModel.CommentId, authorization)) - return new UnauthorizedResult(); - - UpdateCommentServiceModel updateCommentServiceModel = - this._commentMapper.Map<UpdateCommentServiceModel>(updateCommentWebModel); - updateCommentServiceModel.CreatorId = userId; - - Guid id = await this._commentService.UpdateComment(updateCommentServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult("Unable to update comment!") : - new OkObjectResult(new { Id = id }); - } - - [HttpDelete] - public async Task<IActionResult> DeleteComment(Guid id, [FromHeader] string authorization) - { - if (!await this._commentService.ValidateJwtForComment(id, authorization)) - return new UnauthorizedResult(); - - return await this._commentService.DeleteComment(id) ? - new OkResult() : - new BadRequestObjectResult("Could not delete Comment"); - } - - } -} - diff --git a/src/DevHive.Web/Controllers/FeedController.cs b/src/DevHive.Web/Controllers/FeedController.cs deleted file mode 100644 index abca3e4..0000000 --- a/src/DevHive.Web/Controllers/FeedController.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Threading.Tasks; -using AutoMapper; -using DevHive.Services.Interfaces; -using DevHive.Services.Models; -using DevHive.Web.Models.Comment; -using DevHive.Web.Models.Feed; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - [Authorize(Roles = "User,Admin")] - public class FeedController - { - private readonly IFeedService _feedService; - private readonly IMapper _mapper; - - public FeedController(IFeedService feedService, IMapper mapper) - { - this._feedService = feedService; - this._mapper = mapper; - } - - [HttpPost] - [Route("GetPosts")] - public async Task<IActionResult> GetPosts(Guid userId, [FromBody] GetPageWebModel getPageWebModel) - { - GetPageServiceModel getPageServiceModel = this._mapper.Map<GetPageServiceModel>(getPageWebModel); - getPageServiceModel.UserId = userId; - - ReadPageServiceModel readPageServiceModel = await this._feedService.GetPage(getPageServiceModel); - ReadPageWebModel readPageWebModel = this._mapper.Map<ReadPageWebModel>(readPageServiceModel); - - return new OkObjectResult(readPageWebModel); - } - - [HttpPost] - [Route("GetUserPosts")] - [AllowAnonymous] - public async Task<IActionResult> GetUserPosts(string username, [FromBody] GetPageWebModel getPageWebModel) - { - GetPageServiceModel getPageServiceModel = this._mapper.Map<GetPageServiceModel>(getPageWebModel); - getPageServiceModel.Username = username; - - ReadPageServiceModel readPageServiceModel = await this._feedService.GetUserPage(getPageServiceModel); - ReadPageWebModel readPageWebModel = this._mapper.Map<ReadPageWebModel>(readPageServiceModel); - - return new OkObjectResult(readPageWebModel); - } - } -} diff --git a/src/DevHive.Web/Controllers/LanguageController.cs b/src/DevHive.Web/Controllers/LanguageController.cs deleted file mode 100644 index 5b0d5de..0000000 --- a/src/DevHive.Web/Controllers/LanguageController.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using AutoMapper; -using DevHive.Services.Interfaces; -using DevHive.Services.Models.Language; -using DevHive.Web.Models.Language; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - public class LanguageController - { - private readonly ILanguageService _languageService; - private readonly IMapper _languageMapper; - - public LanguageController(ILanguageService languageService, IMapper mapper) - { - this._languageService = languageService; - this._languageMapper = mapper; - } - - [HttpPost] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Create([FromBody] CreateLanguageWebModel createLanguageWebModel) - { - CreateLanguageServiceModel languageServiceModel = this._languageMapper.Map<CreateLanguageServiceModel>(createLanguageWebModel); - - Guid id = await this._languageService.CreateLanguage(languageServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult($"Could not create language {createLanguageWebModel.Name}") : - new OkObjectResult(new { Id = id }); - } - - [HttpGet] - [AllowAnonymous] - public async Task<IActionResult> GetById(Guid id) - { - ReadLanguageServiceModel languageServiceModel = await this._languageService.GetLanguageById(id); - ReadLanguageWebModel languageWebModel = this._languageMapper.Map<ReadLanguageWebModel>(languageServiceModel); - - return new OkObjectResult(languageWebModel); - } - - [HttpGet] - [Route("GetLanguages")] - [Authorize(Roles = "User,Admin")] - public IActionResult GetAllExistingLanguages() - { - HashSet<ReadLanguageServiceModel> languageServiceModels = this._languageService.GetLanguages(); - HashSet<ReadLanguageWebModel> languageWebModels = this._languageMapper.Map<HashSet<ReadLanguageWebModel>>(languageServiceModels); - - return new OkObjectResult(languageWebModels); - } - - [HttpPut] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Update(Guid id, [FromBody] UpdateLanguageWebModel updateModel) - { - UpdateLanguageServiceModel updatelanguageServiceModel = this._languageMapper.Map<UpdateLanguageServiceModel>(updateModel); - updatelanguageServiceModel.Id = id; - - bool result = await this._languageService.UpdateLanguage(updatelanguageServiceModel); - - if (!result) - return new BadRequestObjectResult("Could not update Language"); - - return new OkResult(); - } - - [HttpDelete] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Delete(Guid id) - { - bool result = await this._languageService.DeleteLanguage(id); - - if (!result) - return new BadRequestObjectResult("Could not delete Language"); - - return new OkResult(); - } - } -} diff --git a/src/DevHive.Web/Controllers/PostController.cs b/src/DevHive.Web/Controllers/PostController.cs deleted file mode 100644 index d3fdbf6..0000000 --- a/src/DevHive.Web/Controllers/PostController.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using AutoMapper; -using System; -using DevHive.Web.Models.Post; -using DevHive.Services.Models.Post; -using Microsoft.AspNetCore.Authorization; -using DevHive.Services.Interfaces; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - [Authorize(Roles = "User,Admin")] - public class PostController - { - private readonly IPostService _postService; - private readonly IMapper _postMapper; - - public PostController(IPostService postService, IMapper postMapper) - { - this._postService = postService; - this._postMapper = postMapper; - } - - #region Create - [HttpPost] - public async Task<IActionResult> Create(Guid userId, [FromForm] CreatePostWebModel createPostWebModel, [FromHeader] string authorization) - { - if (!await this._postService.ValidateJwtForCreating(userId, authorization)) - return new UnauthorizedResult(); - - CreatePostServiceModel createPostServiceModel = - this._postMapper.Map<CreatePostServiceModel>(createPostWebModel); - createPostServiceModel.CreatorId = userId; - - Guid id = await this._postService.CreatePost(createPostServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult("Could not create post!") : - new OkObjectResult(new { Id = id }); - } - #endregion - - #region Read - [HttpGet] - [AllowAnonymous] - public async Task<IActionResult> GetById(Guid id) - { - ReadPostServiceModel postServiceModel = await this._postService.GetPostById(id); - ReadPostWebModel postWebModel = this._postMapper.Map<ReadPostWebModel>(postServiceModel); - - return new OkObjectResult(postWebModel); - } - #endregion - - #region Update - [HttpPut] - public async Task<IActionResult> Update(Guid userId, [FromForm] UpdatePostWebModel updatePostWebModel, [FromHeader] string authorization) - { - if (!await this._postService.ValidateJwtForPost(updatePostWebModel.PostId, authorization)) - return new UnauthorizedResult(); - - UpdatePostServiceModel updatePostServiceModel = - this._postMapper.Map<UpdatePostServiceModel>(updatePostWebModel); - updatePostServiceModel.CreatorId = userId; - - Guid id = await this._postService.UpdatePost(updatePostServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult("Could not update post!") : - new OkObjectResult(new { Id = id }); - } - #endregion - - #region Delete - [HttpDelete] - public async Task<IActionResult> Delete(Guid id, [FromHeader] string authorization) - { - if (!await this._postService.ValidateJwtForPost(id, authorization)) - return new UnauthorizedResult(); - - return await this._postService.DeletePost(id) ? - new OkResult() : - new BadRequestObjectResult("Could not delete Post"); - } - #endregion - } -} diff --git a/src/DevHive.Web/Controllers/RateController.cs b/src/DevHive.Web/Controllers/RateController.cs deleted file mode 100644 index 68b859b..0000000 --- a/src/DevHive.Web/Controllers/RateController.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Threading.Tasks; -using AutoMapper; -using DevHive.Services.Interfaces; -using DevHive.Services.Models.Post.Rating; -using DevHive.Web.Models.Post.Rating; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("api/[controller]")] - public class RateController - { - private readonly IRateService _rateService; - private readonly IUserService _userService; - private readonly IMapper _mapper; - - public RateController(IRateService rateService, IUserService userService, IMapper mapper) - { - this._rateService = rateService; - this._userService = userService; - this._mapper = mapper; - } - - [HttpPost] - [Authorize(Roles = "Admin,User")] - public async Task<IActionResult> RatePost(Guid userId, [FromBody] RatePostWebModel ratePostWebModel, [FromHeader] string authorization) - { - RatePostServiceModel ratePostServiceModel = this._mapper.Map<RatePostServiceModel>(ratePostWebModel); - ratePostServiceModel.UserId = userId; - - ReadPostRatingServiceModel readPostRatingServiceModel = await this._rateService.RatePost(ratePostServiceModel); - ReadPostRatingWebModel readPostRatingWebModel = this._mapper.Map<ReadPostRatingWebModel>(readPostRatingServiceModel); - - return new OkObjectResult(readPostRatingWebModel); - } - } -} diff --git a/src/DevHive.Web/Controllers/RoleController.cs b/src/DevHive.Web/Controllers/RoleController.cs deleted file mode 100644 index 0d2a2eb..0000000 --- a/src/DevHive.Web/Controllers/RoleController.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using DevHive.Web.Models.Identity.Role; -using AutoMapper; -using System; -using DevHive.Services.Interfaces; -using DevHive.Services.Models.Identity.Role; -using Microsoft.AspNetCore.Authorization; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - public class RoleController - { - private readonly IRoleService _roleService; - private readonly IMapper _roleMapper; - - public RoleController(IRoleService roleService, IMapper mapper) - { - this._roleService = roleService; - this._roleMapper = mapper; - } - - [HttpPost] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Create([FromBody] CreateRoleWebModel createRoleWebModel) - { - CreateRoleServiceModel roleServiceModel = - this._roleMapper.Map<CreateRoleServiceModel>(createRoleWebModel); - - Guid id = await this._roleService.CreateRole(roleServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult($"Could not create role {createRoleWebModel.Name}") : - new OkObjectResult(new { Id = id }); - } - - [HttpGet] - [Authorize(Roles = "User,Admin")] - public async Task<IActionResult> GetById(Guid id) - { - RoleServiceModel roleServiceModel = await this._roleService.GetRoleById(id); - RoleWebModel roleWebModel = this._roleMapper.Map<RoleWebModel>(roleServiceModel); - - return new OkObjectResult(roleWebModel); - } - - [HttpPut] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Update(Guid id, [FromBody] UpdateRoleWebModel updateRoleWebModel) - { - UpdateRoleServiceModel updateRoleServiceModel = - this._roleMapper.Map<UpdateRoleServiceModel>(updateRoleWebModel); - updateRoleServiceModel.Id = id; - - bool result = await this._roleService.UpdateRole(updateRoleServiceModel); - - if (!result) - return new BadRequestObjectResult("Could not update role!"); - - return new OkResult(); - } - - [HttpDelete] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Delete(Guid id) - { - bool result = await this._roleService.DeleteRole(id); - - if (!result) - return new BadRequestObjectResult("Could not delete role!"); - - return new OkResult(); - } - } -} diff --git a/src/DevHive.Web/Controllers/TechnologyController.cs b/src/DevHive.Web/Controllers/TechnologyController.cs deleted file mode 100644 index e507899..0000000 --- a/src/DevHive.Web/Controllers/TechnologyController.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using AutoMapper; -using DevHive.Services.Interfaces; -using DevHive.Services.Models.Technology; -using DevHive.Web.Models.Technology; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - public class TechnologyController - { - private readonly ITechnologyService _technologyService; - private readonly IMapper _technologyMapper; - - public TechnologyController(ITechnologyService technologyService, IMapper technologyMapper) - { - this._technologyService = technologyService; - this._technologyMapper = technologyMapper; - } - - [HttpPost] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Create([FromBody] CreateTechnologyWebModel createTechnologyWebModel) - { - CreateTechnologyServiceModel technologyServiceModel = this._technologyMapper.Map<CreateTechnologyServiceModel>(createTechnologyWebModel); - - Guid id = await this._technologyService.CreateTechnology(technologyServiceModel); - - return id == Guid.Empty ? - new BadRequestObjectResult($"Could not create technology {createTechnologyWebModel.Name}") : - new OkObjectResult(new { Id = id }); - } - - [HttpGet] - [AllowAnonymous] - public async Task<IActionResult> GetById(Guid id) - { - ReadTechnologyServiceModel readTechnologyServiceModel = await this._technologyService.GetTechnologyById(id); - ReadTechnologyWebModel readTechnologyWebModel = this._technologyMapper.Map<ReadTechnologyWebModel>(readTechnologyServiceModel); - - return new OkObjectResult(readTechnologyWebModel); - } - - [HttpGet] - [Route("GetTechnologies")] - [Authorize(Roles = "User,Admin")] - public IActionResult GetAllExistingTechnologies() - { - HashSet<ReadTechnologyServiceModel> technologyServiceModels = this._technologyService.GetTechnologies(); - HashSet<ReadTechnologyWebModel> languageWebModels = this._technologyMapper.Map<HashSet<ReadTechnologyWebModel>>(technologyServiceModels); - - return new OkObjectResult(languageWebModels); - } - - [HttpPut] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Update(Guid id, [FromBody] UpdateTechnologyWebModel updateModel) - { - UpdateTechnologyServiceModel updateTechnologyServiceModel = this._technologyMapper.Map<UpdateTechnologyServiceModel>(updateModel); - updateTechnologyServiceModel.Id = id; - - bool result = await this._technologyService.UpdateTechnology(updateTechnologyServiceModel); - - if (!result) - return new BadRequestObjectResult("Could not update Technology"); - - return new OkResult(); - } - - [HttpDelete] - [Authorize(Roles = "Admin")] - public async Task<IActionResult> Delete(Guid id) - { - bool result = await this._technologyService.DeleteTechnology(id); - - if (!result) - return new BadRequestObjectResult("Could not delete Technology"); - - return new OkResult(); - } - } -} diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs deleted file mode 100644 index 109bbaa..0000000 --- a/src/DevHive.Web/Controllers/UserController.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.Threading.Tasks; -using AutoMapper; -using DevHive.Services.Models.Identity.User; -using DevHive.Web.Models.Identity.User; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using DevHive.Common.Models.Identity; -using DevHive.Services.Interfaces; -using Microsoft.Extensions.Hosting; - -namespace DevHive.Web.Controllers -{ - [ApiController] - [Route("/api/[controller]")] - public class UserController : ControllerBase - { - private readonly IUserService _userService; - private readonly IMapper _userMapper; - - public UserController(IUserService userService, IMapper mapper) - { - this._userService = userService; - this._userMapper = mapper; - } - - #region Authentication - [HttpPost] - [Route("Login")] - [AllowAnonymous] - public async Task<IActionResult> Login([FromBody] LoginWebModel loginModel) - { - LoginServiceModel loginServiceModel = this._userMapper.Map<LoginServiceModel>(loginModel); - - TokenModel TokenModel = await this._userService.LoginUser(loginServiceModel); - TokenWebModel tokenWebModel = this._userMapper.Map<TokenWebModel>(TokenModel); - - return new OkObjectResult(tokenWebModel); - } - - [HttpPost] - [Route("Register")] - [AllowAnonymous] - public async Task<IActionResult> Register([FromBody] RegisterWebModel registerModel) - { - RegisterServiceModel registerServiceModel = this._userMapper.Map<RegisterServiceModel>(registerModel); - - TokenModel TokenModel = await this._userService.RegisterUser(registerServiceModel); - TokenWebModel tokenWebModel = this._userMapper.Map<TokenWebModel>(TokenModel); - - return new CreatedResult("Register", tokenWebModel); - } - #endregion - - #region Read - [HttpGet] - [Authorize(Roles = "User,Admin")] - public async Task<IActionResult> GetById(Guid id, [FromHeader] string authorization) - { - if (!await this._userService.ValidJWT(id, authorization)) - return new UnauthorizedResult(); - - UserServiceModel userServiceModel = await this._userService.GetUserById(id); - UserWebModel userWebModel = this._userMapper.Map<UserWebModel>(userServiceModel); - - return new OkObjectResult(userWebModel); - } - - [HttpGet] - [Route("GetUser")] - [AllowAnonymous] - public async Task<IActionResult> GetUser(string username) - { - UserServiceModel friendServiceModel = await this._userService.GetUserByUsername(username); - UserWebModel friend = this._userMapper.Map<UserWebModel>(friendServiceModel); - - return new OkObjectResult(friend); - } - #endregion - - #region Update - [HttpPut] - [Authorize(Roles = "User,Admin")] - public async Task<IActionResult> Update(Guid id, [FromBody] UpdateUserWebModel updateUserWebModel, [FromHeader] string authorization) - { - if (!await this._userService.ValidJWT(id, authorization)) - return new UnauthorizedResult(); - - UpdateUserServiceModel updateUserServiceModel = this._userMapper.Map<UpdateUserServiceModel>(updateUserWebModel); - updateUserServiceModel.Id = id; - - UserServiceModel userServiceModel = await this._userService.UpdateUser(updateUserServiceModel); - UserWebModel userWebModel = this._userMapper.Map<UserWebModel>(userServiceModel); - - return new AcceptedResult("UpdateUser", userWebModel); - } - - [HttpPut] - [Route("ProfilePicture")] - [Authorize(Roles = "User,Admin")] - public async Task<IActionResult> UpdateProfilePicture(Guid userId, [FromForm] UpdateProfilePictureWebModel updateProfilePictureWebModel, [FromHeader] string authorization) - { - if (!await this._userService.ValidJWT(userId, authorization)) - return new UnauthorizedResult(); - - UpdateProfilePictureServiceModel updateProfilePictureServiceModel = this._userMapper.Map<UpdateProfilePictureServiceModel>(updateProfilePictureWebModel); - updateProfilePictureServiceModel.UserId = userId; - - ProfilePictureServiceModel profilePictureServiceModel = await this._userService.UpdateProfilePicture(updateProfilePictureServiceModel); - ProfilePictureWebModel profilePictureWebModel = this._userMapper.Map<ProfilePictureWebModel>(profilePictureServiceModel); - - return new AcceptedResult("UpdateProfilePicture", profilePictureWebModel); - } - #endregion - - #region Delete - [HttpDelete] - [Authorize(Roles = "User,Admin")] - public async Task<IActionResult> Delete(Guid id, [FromHeader] string authorization) - { - if (!await this._userService.ValidJWT(id, authorization)) - return new UnauthorizedResult(); - - bool result = await this._userService.DeleteUser(id); - if (!result) - return new BadRequestObjectResult("Could not delete User"); - - return new OkResult(); - } - #endregion - - [HttpPost] - [Authorize(Roles = "User,Admin")] - [Route("SuperSecretPromotionToAdmin")] - public async Task<IActionResult> SuperSecretPromotionToAdmin(Guid userId) - { - return new OkObjectResult(await this._userService.SuperSecretPromotionToAdmin(userId)); - } - } -} |
