private async void btnSave_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { var genreList = clbGenre.CheckedItems.Cast <Genre>(); var genreIdList = genreList.Select(x => x.Id).ToList(); request.Title = txtTitle.Text; request.Budget = double.Parse(txtBudget.Text); request.Description = rtxtDescription.Text; request.Finished = chkFinished.Checked; request.Language = txtLang.Text; request.NumberOfRatings = 0; request.ReleaseDate = dtRelaseDate.Value; request.RunningTime = txtRtime.Text; request.GenreIds = genreIdList; var idProductionComp = cmbProductionComp.SelectedValue; if (int.TryParse(idProductionComp.ToString(), out int idProductionCompany)) { request.ProductionCompanyId = idProductionCompany; } var mtvs = await _serviceMovieAndTvShow.Insert <MovieAndTvshow>(request); if (mtvs == default(MovieAndTvshow)) { return; } MessageBox.Show("Operation successfully completed, now assign cast !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); txtBudget.Text = ""; txtTitle.Text = ""; txtRtime.Text = ""; txtPoster.Text = ""; txtLang.Text = ""; rtxtDescription.Text = null; dtRelaseDate.Value = DateTime.Now; chkFinished.Checked = false; clbGenre.ClearSelected(); if (chkTvShow.Checked) { frmCastAdd frm = new frmCastAdd(mtvs, true); frm.ShowDialog(); } else { frmCastAdd frm = new frmCastAdd(mtvs); frm.ShowDialog(); } } }
private void btnEditCast_Click_1(object sender, EventArgs e) { frmCastAdd frm = new frmCastAdd(_MTVS); frm.ShowDialog(); }