//[AllowAnonymous] public ActionResult Invitelogin(int inviterId, int projectId) { string tempIp = Request.UserHostAddress; var loginStatusModel = new LoginStatusModel { Ip = tempIp, LoginDateUtc = DateTime.UtcNow }; Api.AccountController.UpdateLoginInfo(loginStatusModel, AuthUtility.GetUserId(User), _userManager, _userService); var res = GetUserProfile(_userManager); var user = res; Session["UserId"] = user.Id; Session["Email"] = user.Email; var host = Utility.GetHost(Request.Url); var roles = AuthUtility.GetUserRoles(User.Identity); var userId = AuthUtility.GetUserId(User); var userEntity = _userManager.FindById(userId); //获取邀请人名字和项目内容 var appModel = Api.CloudController.GetClouds(userEntity, _uservaultService, _cloudService, _vaultTemplateService, _vaultService, _mfvaultService, host, roles); //_usercloudService, Session["userApp"] = appModel; var inviterRes = GetUserProfile(_userManager, inviterId); var inviterProfile = inviterRes; var projectRes = Api.ProjectController.GetProject(projectId, _projService, _mfvaultService, _vaultTemplateService); var project = projectRes; var returnStr = "{'state':'success','inviter':'" + inviterProfile.UserName + "','projectName':'" + project.Name + "','projectDes':'" + project.Description + "'}"; return(Content(returnStr)); }
public async Task <IHttpActionResult> Clouds() { var userId = Authentication.User.Identity.GetUserId <int>(); try { var user = _userService.GetUserById(userId); var roles = AuthUtility.GetUserRoles(User.Identity); var host = GetHost(); Log.Info("before await Task.Run(() => GetClouds"); var uApps = await Task.Run(() => GetClouds(user, _uservaultService, _cloudService, _vaultTemplateService, _vaultService, _mfvaultService, host, roles)); Log.Info("after await Task.Run(() => GetClouds"); return(Ok(uApps)); } catch (Exception ex) { Log.Info("Exception await Task.Run(() => GetClouds"); return(CreateErrorResponse("获取用户的云失败:", HttpStatusCode.ServiceUnavailable, ex, Log)); } }