using Entities.Contracts; using Entities.DTO; using Microsoft.AspNetCore.Identity; using SharedDATA.Api; using TechHelper.Services; namespace TechHelper.Server.Services { public class UserServices : IUserSerivces { private readonly IUnitOfWork _unitOfWork; private readonly IClassService _classService; private readonly UserManager _userManager; public UserServices(IUnitOfWork unitOfWork, IClassService classService, UserManager userManager) { _unitOfWork = unitOfWork; _classService = classService; _userManager = userManager; } public Task AddAsync(User model) { throw new NotImplementedException(); } public Task DeleteAsync(Guid id) { throw new NotImplementedException(); } public Task GetAllAsync(QueryParameter query) { throw new NotImplementedException(); } public Task GetAsync(Guid id) { throw new NotImplementedException(); } public Task GetStudentDetailInfo(Guid userId) { throw new NotImplementedException(); } public async Task RestoreUserRoleInformation(User user) { var result = await _classService.GetUserClassRole(user.Id); if (result.Status) { var classRole = result.Result as UserClassRoleDto; if (classRole != null) { if (!await _userManager.IsInRoleAsync(user, classRole.Role)) { await _userManager.AddToRoleAsync(user, classRole.Role); return ApiResponse.Success(); } } } return ApiResponse.Error(); } public Task UpdateAsync(User model) { throw new NotImplementedException(); } public Task VerifyUserInformation(Guid userId) { throw new NotImplementedException(); } } }