Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS newCustomer = new CUSTOMERS()
                {
                    document_type = textBox1.Text,
                    document_nro  = textBox2.Text,
                    customer_name = textBox3.Text,
                    address       = textBox4.Text,
                    phone         = textBox5.Text,
                    email         = textBox6.Text,
                    state         = textBox7.Text,
                };

                customerService.InsertCustomer(newCustomer);

                Datos Check = new Datos();
                Check.Show();
                Hide();
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }
        public ActionResult Edit(int id)
        {
            customerService = new Order_Graber_DataService.Services.CustomerService();
            CUSTOMERS editCustomer = new CUSTOMERS();


            editCustomer = customerService.GetCustomerById(id);


            return(View(editCustomer));
        }
        public ActionResult Delete(int id)
        {
            customerService = new Order_Graber_DataService.Services.CustomerService();
            CUSTOMERS deleteCustomer = new CUSTOMERS();

            deleteCustomer = customerService.GetCustomerById(id);



            return(View(deleteCustomer));
        }
        public ActionResult Delete(int id, CUSTOMERS datosFront)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS deleteCustomer = new CUSTOMERS()
                {
                    client_id = id,
                };

                customerService.DeleteCustomer(deleteCustomer.client_id);

                return(RedirectToAction("IndexCustomer"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(CUSTOMERS datosFront)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS newCustomer = new CUSTOMERS()
                {
                    document_type = datosFront.document_type,
                    document_nro  = datosFront.document_nro,
                    customer_name = datosFront.customer_name,
                    address       = datosFront.address,
                    phone         = datosFront.phone,
                    email         = datosFront.email,
                    state         = datosFront.state
                };

                customerService.InsertCustomer(newCustomer);
                return(RedirectToAction("IndexCustomer"));
            }
            catch
            {
                return(View());
            }
        }