public async Task <ActionResult> LoginPage(LoginUserModel loginUserModel) { if (ModelState.IsValid) { TokenContent rest = await _loginApiService.Authenticate(ApiUrl + "token", loginUserModel); if (rest.access_token != null) { InstructorDto ınstructorDto = await _userApiService.Get(rest.access_token, ApiUrl + "api/User", loginUserModel); string[] roles = new string[ınstructorDto.Roles.Count]; for (int i = 0; i < ınstructorDto.Roles.Count; i++) { ınstructorDto.Roles.ForEach(x => roles[i] = x.Name.ToString()); } AuthenticationHelper.CreateAuthCookie(ınstructorDto.Id, ınstructorDto.UserName, DateTime.Now.AddDays(1), roles, false, ınstructorDto.FirstName, ınstructorDto.LastName); //FormsAuthentication.SetAuthCookie(loginUserModel.Username, false); Session["access_token"] = rest.access_token; return(RedirectToAction("Index", "Home")); } ViewBag.LoginError = "Kullanıcı Adı ve paralo uyuşmamaktadır!"; } return(View(loginUserModel)); }
private async void UpdateUser() { var result = await UserApiService.Get(); if (!result.Error) { AppStatus.UserLogged = result; } }
private async void RequestProfile() { var response = await UserApiService.Get(); if (response != null && !response.Error) { AppStatus.UserLogged = response; UpdateInfoProfile(); } }
public async void RequestProfile(bool updateUser) { try { UpdateInfoProfile(); if (updateUser) { var response = await UserApiService.Get(); if (response != null && !response.Error) { AppStatus.UserLogged = response; UpdateInfoProfile(); } } } catch (Exception exception) { InsightsUtils.LogException(exception); } }
protected async Task Load() { Items = await UserApiService.Get(); IsLoading = false; }
protected async Task Load() { _user = await UserApiService.Get(Id); IsLoading = false; }