private async void frmUpdateAlbum_Load(object sender, EventArgs e)
        {
            //get object we want to update
            Album obj = await _albumService.GetById <Album>(_albumId, "GetAlbumById");

            //get all performers
            cmbPerformer.DataSource = await _performerService.Get <List <Performer> >(null, "GetPerformers");

            cmbPerformer.DisplayMember = "ArtisticName";
            cmbPerformer.ValueMember   = "Id";
            cmbPerformer.SelectedValue = obj.Performer.Id; //set selected value from db object

            //get all genres
            cmbGenre.DataSource = await _genreService.Get <List <Genre> >(null, "GetGenres");

            cmbGenre.DisplayMember = "Name";
            cmbGenre.ValueMember   = "Id";
            cmbGenre.SelectedValue = obj.Genre.Id; //set selected value from db object


            cmbYear.DataSource = Enumerable.Range(1900, 130).ToList();
            txtTitle.Text      = obj.Name;

            //prepare image for display
            if (obj.Image.Length != 0)
            {
                picboxAlbum.Image = ImageHelperMethods.ResizeImage(ImageHelperMethods.PrepareImgForDisplayFromDB(obj.Image), 120, 140);
            }
        }
예제 #2
0
        private async void FrmSongDetails_Load(object sender, EventArgs e)
        {
            if (!_id.Equals(null))
            {
                SongGetRequest song = await _songService.GetById <SongGetRequest>(_id, "GetSongById");

                txtboxLyrics.Text = song.Text;
                txtBoxTitle.Text  = song.Title;
                txtboxAlbum.Text  = song.Album.Name;
                txtboxGenre.Text  = song.Album.Genre.Name;
                picboxAlbum.Image = ImageHelperMethods.ResizeImage(ImageHelperMethods.PrepareImgForDisplayFromDB(song.Album.Image), 100, 100);
            }
        }