using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Music.Presentation;
using Music.Model;
using Web.Views.Shared;
using StructureMap;

namespace Web.Views.Song
{
    public partial class ArtistSongs : System.Web.UI.Page, IArtistSongsView
    {
        private IArtistSongsPresenter _presenter;

        protected void Page_Init(object sender, EventArgs e)
        {
            _presenter = new ArtistSongsPresenter(this, ObjectFactory.GetInstance<SongService>());
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter.Display();
        }

        #region IArtistSongsView Members

        public int ArtistId
        {
            get
            {
                return int.Parse(Request.QueryString["ArtistId"]);
            }
        }

        public Artist Artist
        {
            set
            {
                litArtistName.Text = value.ArtistName;
            }
        }

        public IEnumerable<Music.Model.Song> ArtistSongList
        {
            set
            {
                plArtistSongs.SetSongsToDisplay(value);
            }
        }

        public IEnumerable<Artist> ArtistList
        {
            set
            {
                MusicStore musicMasterPage = (MusicStore)Page.Master;
                musicMasterPage.ArtistListControl.SetArtistsToDisplay(value);
            }
        }

        #endregion
    }
}