private void _view_UserAdd(object sender, EventArgs e) { var user = new User() { Name = _view.UserName, Age = Convert.ToInt32(_view.UserAge) }; _model.AddItem(user); _facade.SendNotification(ApplicationFacade.USER_ADDED); }
private void newItemConfirmButton_Click(object sender, EventArgs e) { if (newItemName.Text.Length == 0 || newItemPrice.Text.Length == 0 || newItemOnStock.Text.Length == 0) { MessageBox.Show("Invalid data"); } else { ItemDTO newItem = new ItemDTO { Name = newItemName.Text, Price = Convert.ToDouble(newItemPrice.Text), OnStock = Convert.ToInt32(newItemOnStock.Text) }; _shipper.AddItem(newItem); MessageBox.Show("Item was successfully created!"); this.Close(); } }