Esempio n. 1
0
        // public List<user_controller> GetUsernames()
        // {
        //     var connect = Connect();
        //     List<user_controller> usernames = connect.Query<user_controller>("SELECT username FROM users").ToList();
        //     return usernames;
        // }

        public bool AddPhoto(ValuePhoto photo)
        {
            var connect    = Connect();
            int PhotoAdded = connect.Execute(
                @"INSERT INTO pictures(title, description, price, path, category_id) VALUES (@title, @description, @price, @path, @category_id)"
                , photo);

            return(PhotoAdded == 1);
        }
Esempio n. 2
0
        public ValuePhoto Update(ValuePhoto photo)
        {
            var        connect      = Connect();
            ValuePhoto UpdatedPhoto = connect.QuerySingle <ValuePhoto>(sql: @"UPDATE pictures SET title = @title, description = @description, 
                                                                            price = @price, path = @path, category_id = @category_id
                                                                            WHERE picture_id = @picture_id;
                                                                            SELECT * FROM pictures WHERE picture_id = @picture_id", photo);

            return(UpdatedPhoto);
        }