public IHttpActionResult FetchUserInfo() { var user = _userQueryService.Get(RequestContext.Principal.Identity.Name); return(Ok(new { userId = user.UserId, userName = $"{user.FirstName} {user.LastName}", role = user.UserType.Name, claims = user.UserType.Claims, playerInfo = user.PlayerInfo, family = user.Family != null ? new { name = user.Family.Name, id = user.Family.FamilyId } : null, gender = user.Gender.ToString(), birthDate = user.BirthDate, imageUrl = user.ImageUrl, description = user.Description, city = user.City, country = user.Country, accountId = user.AccountId, playerInfoId = user.PlayerInfoId })); }
public ActionResult ChangePassword(int id) { Entities.User user = _userQuery.Get(id); if (user == null) { throw new ApplicationException("用户信息不存在"); } var viewmodel = new ChangePasswordViewModel { UserId = user.Id, Username = user.Username }; return(View("~/Views/Settings/User/ChangePassword.cshtml", viewmodel)); }
public void AdjustPlayerExpirience(Guid userId, decimal expirienceAmount) { var user = _userQueryService.Get(userId); using (var contextScope = ContextScopeFactory.Create()) { var domain = _playerInfoRepository.GetById(user.PlayerInfoId); var result = _expirienceQueryService.ApplayExpirience(user.PlayerInfo, expirienceAmount); domain.ExpirienceAmount = result.ResultExpitience; domain.Level = result.ResultLevel; _playerInfoRepository.Update(domain); contextScope.SaveChanges(); } }
public IHttpActionResult FamilyUserInfo(Guid userId) { var user = _userQueryService.Get(userId); var nextLevel = _expirienceQueryService.GetExpirience(user.PlayerInfo.Level + 1); return(Ok(new { userId = user.UserId, userName = $"{user.FirstName} {user.LastName}", playerInfo = new { level = user.PlayerInfo.Level, expirienceAmount = user.PlayerInfo.ExpirienceAmount, expirienceToNextLevel = nextLevel.ExpirienceAmount }, gender = user.Gender.ToString(), birthDate = user.BirthDate.ToShortDateString(), imageUrl = user.ImageUrl, description = user.Description, city = user.City, country = user.Country })); }
public async Task <UserFormViewModel> GetUser(Guid id) { return(await _userQueryService.Get(id)); }
public async Task <IList <UserDto> > Handle(GetUsersRequestModel request, CancellationToken cancellationToken) => await userQueryService.Get();
public async Task <UserDto> Handle(GetUserByIdRequestModel request, CancellationToken cancellationToken) => await userQueryService.Get(request.UserId);