Ejemplo n.º 1
0
        private void SaveChanges(EntityState entityState, CustomerModel customerModel)
        {
            switch (entityState)
            {
            case EntityState.Add:
                customerModel.InsertCustomer();
                break;

            case EntityState.Edit:
                customerModel.EditCustomer();
                break;

            case EntityState.Delete:
                customerModel.DeleteCustomer();
                break;

            default:
                DialogConfirm.GetDialogResult("Debe Seleccionar la operación a realizar", "Exclamation");
                break;
            }
        }
Ejemplo n.º 2
0
        // Allows editing of a customer
        public ActionResult edit()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // Checks if logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Creates an department placeholder
                Customer customer = new Customer();

                // Establish customer model
                CustomerModel customerModel = new CustomerModel();

                // Setup address edit
                customer.ID         = int.Parse(Request.Form["id"]);
                customer.Address_ID = int.Parse(Request.Form["addressID"]);
                customer.Name       = Request.Form["customerName"];

                // Conduct edit
                customerModel.EditCustomer(customer);

                // Passes back to the view
                return(Redirect("/Customer/Customer"));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }