namespace Reconstruction.Functions
{
    public static class Authorization
    {
        static string Login;
        static string Password;
        public static void LogIn()
        {
            Console.Clear();
            Console.Write("Enter your login name: ");
            Login = Convert.ToString(Console.ReadLine());
            Console.Write("Enter your password: ");
            Password = Convert.ToString(Console.ReadLine());

            Service.LoggedUser = Service.db.Users.FirstOrDefault(u => u.Login == Login && u.Password == Password);

            if(Service.LoggedUser != null)
            {
                Service.IsLoggedIn = true;
            }
            else
            {
                Console.Write("A wrong login or password was entered or error happened... ");
            }

            Console.Clear();

        }
    }
}
