public static void Add(string login, string password, int roleId = 3)
 {
     using var db = new DbCinema();
     db.Users
     .Value(user => user.Login, login)
     .Value(user => user.Password, PasswordCipher.ConvertPassword(password))
     .Value(user => user.RoleId, roleId)
     .Insert();
 }
        public static bool Login(string login, string password)
        {
            using var db = new DbCinema();
            string encodedPassword = PasswordCipher.ConvertPassword(password);
            var    queryable       = from user in db.Users
                                     where user.Login == login && user.Password == encodedPassword
                                     select user;

            return(queryable.ToList().Count > 0);
        }
        public static void Update(int id, string?password = null, int?roleId = null)
        {
            using var db = new DbCinema();
            var user = Get(id);

            if (password != null)
            {
                user.Password = PasswordCipher.ConvertPassword(password);
            }

            if (roleId != null)
            {
                user.RoleId = (int)roleId;
            }

            db.Update(user);
        }