Exemplo n.º 1
0
        public ActionResult Save(string CompanyName, string Phone)
        {
            Shipper s = new Shipper
            {
                CompanyName = CompanyName,
                Phone       = Phone
            };

            sbo.Insert(s);
            return(RedirectToAction("Index", "Shipper"));
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ShipperBO sb = new ShipperBO();

            switch (Mode)
            {
            case FormMode.Add:
                Shipper s = new Shipper
                {
                    CompanyName = txtCompanyName.Text,
                    Phone       = txtPhone.Text
                };
                if (sb.Insert(s))
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Error");
                }
                break;

            case FormMode.Update:
                SelectedShipper.CompanyName = txtCompanyName.Text;
                SelectedShipper.Phone       = txtPhone.Text;
                if (sb.Update(SelectedShipper))
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Error");
                }
                break;
            }
            this.Close();
        }