public IHttpActionResult GetUserProfile(string userId) { // Get the current user info if (userId == "me" && this.UserToken != null) { userId = this.UserToken.UserId; } var user = this._userRepo.GetUserById(userId); var userProfile = new UserProfileMessage { Username = user.Username, Description = user.Description, GameCreatedCount = user.GameCreatedCount, GameJoinedCount = user.GameJoinedCount, MapModifiedCount = user.MapModifiedCount, PostAddedCount = user.PostAddedCount, WallAddedCount = user.WallAddedCount, LineAddedCount = user.LineAddedCount }; var warsimUser = this.GameManager.UserManager.GetUserById(user.Id); if (warsimUser != null) { userProfile.IsConnected = true; userProfile.IsPlaying = warsimUser.IsPlaying; } return this.Ok(userProfile); }
public void SendMessage(int fromUserId, int toUserId, string message) { var fromUserProfile = _userRepo.Find(u => u.UserProfile).Single(u => u.Id == fromUserId).UserProfile; var toUserProfile = _userRepo.Find(u => u.UserProfile).Single(u => u.Id == toUserId).UserProfile; var userProfileMessage = new UserProfileMessage { FromUserProfileId = fromUserProfile.Id, ToUserProfileId = toUserProfile.Id, Message = message, ReadOn = null, CreatedOn = DateTime.UtcNow }; _userProfileMessageRepo.Insert(userProfileMessage); }