Пример #1
0
        public IActionResult Create(Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(View(customer));
            }
            _service.Add(customer);

            return(RedirectToAction(nameof(Index)));
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var customer = new Customer();

            var dialogResult = new EditCustomerForm(customer).ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _cutomerService.Add(customer);
                MetroMessageBox.Show(this, $"Клиент успешно добавлен", "Справка", MessageBoxButtons.OK, MessageBoxIcon.Information);
                UpdateDataGrid();
                UpdateCounter();
            }
        }