Пример #1
0
        public JsonResult Login(AppUserLoginModel appUserLoginModel)
        {
            Response response = new Response();

            tokenProvider = new TokenProvider();
            try
            {
                appUserProvider = new AppUserProvider();

                AppUserModel appuserModel = appUserProvider.GetLoginUser(appUserLoginModel).ResultModel;

                if (appuserModel != null)
                {
                    SessionExtension.Set <AppUserModel>(HttpContext.Session, "Login", appuserModel);

                    response = new Response()
                    {
                        Message     = "success",
                        Status      = true,
                        RedirectUrl = Url.Action("Index", "Home")
                    };
                }
            }
            catch (Exception ex)
            {
                response = new Response()
                {
                    Message = "Fail",
                    Status  = false,
                };
            }
            return(Json(response));
        }
Пример #2
0
        private void BtnLogin_Clicked(object sender, EventArgs e)
        {
            AppUserLoginModel appUserLoginModel = new AppUserLoginModel()
            {
                UserName = ent_UserName.Text,
                Password = ent_Password.Text,
            };

            AppUserModel appuserModel = appUserProvider.GetLoginUser(appUserLoginModel).ResultModel;

            if (appuserModel != null)
            {
                Application.Current.Properties["appUserId"] = appuserModel.AppUser.AppUserId;
                Application.Current.SavePropertiesAsync();
                Navigation.PushModalAsync(new LeftMenu());
            }
            else
            {
                DisplayAlert("Hata", "Kullanıcı Adı Veya Şifre Doğru Değil", "Tekrar Dene");
            }
        }