private void AddOrder_Click(object sender, EventArgs e) { List <Product> products = _productsRepository.List(); List <Client> clients = _clientsRepository.List(); OrderEditForm form = new OrderEditForm(products, clients); var result = form.ShowDialog(); if (result == DialogResult.OK) { _ordersRepository.Insert(form.Order); FillGrids(); } }
private void UpdateOrder_Click(object sender, EventArgs e) { List <Product> products = _productsRepository.List(); List <Client> clients = _clientsRepository.List(); Order order = (Order)OrdersDataGrid.CurrentRow.DataBoundItem; OrderEditForm form = new OrderEditForm(products, clients, order); var result = form.ShowDialog(); if (result == DialogResult.OK) { _ordersRepository.Update(form.Order); FillGrids(); } }