private void FillForm() { if (_movieId != 0) { var result = _moviesLogic.GetById(_movieId); if (!result.Success) { MessageBox.Show(result.Error, result.Info, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txtId.Text = result.Data.Id.ToString(); txtPrice.Text = result.Data?.Price?.ToString(); txtTitle.Text = result.Data?.Title?.ToString(); nmYear.Value = (int)result.Data?.Year; nmAgeRestriction.Value = (int)(result.Data?.AgeRestriction ?? 0); if (result.Data.Copies.Any()) { FillCopies(result.Data.Copies); } if (result.Data.Actors.Any()) { FillCurrentActorsGrid(result.Data.Actors); } FillActorsGrid(result.Data.Actors); return; } FillActorsGrid(); }
public ObjectResponse <bool> AddOrUpdate(ActorDTO actor) { try { if (actor != null) { if (!actor.Movies.Any()) { return(new ObjectResponse <bool> { Success = false, Error = "No Movie Selected", Info = DB_SAVE_ERROR }); } foreach (var movie in actor.Movies) { if (!(movie.Id > 0)) { continue; } var currentMovie = _moviesLogic.GetById(movie.Id); if (!currentMovie.Success) { return(new ObjectResponse <bool> { Success = false, Error = currentMovie.Error, Info = currentMovie.Info }); } return(new ObjectResponse <bool> { Success = false, Error = currentMovie.Error, Info = currentMovie.Info }); } } return(new ObjectResponse <bool> { Success = false }); } catch (Exception ex) { return(new ObjectResponse <bool> { Success = false, Error = ex.GetBaseException().Message, Info = DB_SAVE_ERROR }); } }