Пример #1
0
        public void Logout()
        {
            var rmManager = new RememberMeManager();

            rmManager.RemoveUser();
            Environment.Exit(0);
        }
Пример #2
0
        public async Task Login()
        {
            using (var context = new Context())
            {
                View.ErrorMessage = string.Empty;
                var result = await context.Users
                             .FirstOrDefaultAsync(u => u.Login == View.Login && u.Password == View.Password);

                if (result == null)
                {
                    View.ErrorMessage = "Неверный пароль или логин!";
                    View.Password     = "";
                }
                else
                {
                    var rmManager = new RememberMeManager();

                    if (View.RememberMe)
                    {
                        rmManager.RememberMe(result);
                    }
                    else
                    {
                        rmManager.RemoveUser();
                    }

                    ShowMainForm(result);
                }
            }
        }