Ejemplo n.º 1
0
        private void InsertOrUpdateAction()
        {
            _movieRecord = new MovieRecord
            {
                Id            = CurrentId,
                Name          = _name,
                Year          = _year.ToString(),
                Format        = _format,
                Distributed   = "False",
                DistributedTo = ""
            };

            try
            {
                switch (_action)
                {
                case "insert":
                    _movies.Insert(_movieRecord);
                    break;

                case "update":
                    _movies.Update(_movieRecord);
                    break;
                }
            }
            catch (Exception exception)
            {
                var e = $"'{_name}' failed to {_action} database\n Message : {exception.Message}";

                _dialogService.ShowMessage("Error", e);
            }

            _mainWindow.Populate();
        }