public async Task <UserCoreModel> UpdateAsync(UserCoreModel userCoreModel) { var user = _mapper.Map <UserEntity>(userCoreModel); var update = await _userRepository.UpdateAsync(user); var result = _mapper.Map <UserCoreModel>(update); return(result); }
private string GenerateJwtToken(UserCoreModel user) { // generate token that is valid for 7 days var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.Secret); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new[] { new Claim("id", user.Id.ToString()), new Claim("email", user.Email), //new Claim("role", user.Role.Name), }), Expires = DateTime.UtcNow.AddDays(7), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); return(tokenHandler.WriteToken(token)); }
public Task <UserCoreModel> CreateAsync(UserCoreModel item) { throw new System.NotImplementedException(); }
/// <summary> /// /// </summary> public UserController() { _coreModel = new UserCoreModel(); }