Пример #1
0
        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);
        }
Пример #2
0
 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();
     }
 }