public async Task <IHttpActionResult> SignIn(SignInViewModel model) { var token = await WebApiService.Instance.AuthenticateAsync <TokenViewModel>(model.Email, model.Password); var loginInfo = token.LoginInfo; token.LoginInfo = null;//remove logininfo as it increases token cookie size token.UserId = loginInfo.UserId; var tokenConfig = TokenConfig.GetToken(); tokenConfig.UpdateTokenSession(token); var userPages = await WebApiService.Instance.GetAsync <List <UserPageViewModel> >($"UserPage/Get?id={token.UserId}"); var notificationCount = await WebApiService.Instance.PostAsync <int>($"Notification/Count", loginInfo); var settings = await WebApiService.Instance.GetAsync <List <SettingViewModel> >($"AccessibleToViewSetting/List"); var isHLM = await WebApiService.Instance.GetAsync <bool>($"general/ishlm?roleid={loginInfo.RoleId}"); return(Ok(new { Token = GeneralService.EncryptText(token.AccessToken), UserInfo = loginInfo, UserPages = userPages, NotificationCount = notificationCount, Settings = settings, IsHLM = isHLM })); }
public async Task <IHttpActionResult> Signout() { await WebApiService.Instance.PostAsync("Account/Signout"); var tokenConfig = TokenConfig.GetToken(); tokenConfig.RemoveTokenSession(); return(Ok()); }
public IHttpActionResult DocumentUpload() { var tempPath = System.Configuration.ConfigurationManager.AppSettings["TempFolder"]; var permaPath = System.Configuration.ConfigurationManager.AppSettings["UserFolder"] + TokenConfig.GetToken().GetTokenItems().UserId; var uploadDatModel = HttpContext.Current.Request.Files[0].SaveFile(tempPath, permaPath); return(Ok(uploadDatModel)); }