public void Add_Crew_With_NestedListOfStewardess_ReturnOk()
        {
            //Arrange
            var correctItem = new CrewDTO {
                PilotId = 1, StewardessesId = new List <int> {
                    1, 2
                }
            };
            //Act
            var result = _crewController.Post(correctItem).Result as StatusCodeResult;

            //Assert
            Assert.AreEqual(result.StatusCode, 200);
            //Reset
            _crewController.Delete(_context.Crews.Last().Id).Wait();
        }
Exemplo n.º 2
0
        private void deleteCrewButton_Click(object sender, EventArgs e)
        {
            if (crewsDataGridView.SelectedRows.Count == 0)
            {
                crewWarningLabel.Visible = true;
            }
            else
            {
                crewWarningLabel.Visible = false;
                DataGridViewRow selectedRow = crewsDataGridView.SelectedRows[0];
                int             crewId      = (int)selectedRow.Cells["crewidDataGridViewTextBoxColumn"].Value;

                DialogResult dialogResult = MessageBox.Show("Удалить выбранный экипаж?", "Подтверждение удаления", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    CrewController crewController = new CrewController(crewId);
                    int            result         = crewController.Delete();
                    if (result == 0)
                    {
                        MessageBox.Show("Ошибка выполнения удаления");
                    }

                    FillTables();
                    ShowRowsCountEverywhere();
                }
            }
        }