public void InsertUser(User user)
        {
            conn = new MySqlConnection("Server=localhost;Database=itu;Uid=root;Pwd=root;");
            try
            {
                conn.Open();

                comm = conn.CreateCommand();

                comm.CommandText = "INSERT INTO users(login, pass, firstname, lastname, is_admin) VALUES (@login, @pass, @firstName, @lastName, 1)";
                comm.Parameters.AddWithValue("login", user.login);
                comm.Parameters.AddWithValue("pass", user.pass);
                comm.Parameters.AddWithValue("firstname", user.firstName);
                comm.Parameters.AddWithValue("lastname", user.lastName);

                comm.ExecuteNonQuery();
            }
            catch (Exception e)
            { throw; }
            finally
            { if (conn.State == System.Data.ConnectionState.Open) { conn.Close(); } }
        }
        public User EditUser(User _user)
        {
            try
            {
                using (var context = new LibrarySystemEntities())
                {
                    User olduser = context.Users.FirstOrDefault(c => c.UserId == _user.UserId);
                    if (olduser != null)
                    {
                        olduser.FirstName = _user.FirstName;
                        olduser.LastName = _user.LastName;

                        context.SaveChanges();
                        return olduser;
                    }
                    return null;
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
        public ObservableCollection<User> GetUsers()
        {
            ObservableCollection<User> users = new ObservableCollection<User>();
            conn = new MySqlConnection("Server=localhost;Database=itu;Uid=root;Pwd=root;");
            try
            {
                conn.Open();

                comm = new MySqlCommand();

                comm.CommandText = "SELECT * FROM users;)";
                comm.Connection = conn;

                MySqlDataReader reader = comm.ExecuteReader();
                while (reader.Read())
                {
                    User tmp = new User(reader.GetString(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4), reader.GetString(5));
                    users.Add(tmp);
                }
            }
            catch (Exception e)
            { throw; }
            return users;
        }
        public User AddUser(User _user)
        {
            try
            {
                using (var context = new LibrarySystemEntities())
                {
                    context.Users.Add(_user);

                    context.SaveChanges();
                    return _user;
                }
            }
            catch (Exception)
            {

                throw;
            }
        }