Example #1
0
        public ActionResult deleteThis()
        {
            CustomerModel deleteMe = new CustomerModel();

            deleteMe.DeleteCustomer(int.Parse(Request.Form["ID"]));
            return(Redirect("Customer"));
        }
Example #2
0
        // Allows deleting of customer
        public ActionResult delete()
        {
            // Null handling
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

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

            if (state == true)
            {
                int customerID = int.Parse(RouteData.Values["id"].ToString());

                // Establishes account model
                CustomerModel customerModel = new CustomerModel();

                // Deletes the account, and contact from the database using the ID
                customerModel.DeleteCustomer(customerID);

                // Return to the account page
                return(Redirect("/Customer/Customer"));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }
Example #3
0
 public void Delete()
 {
     if (currentCustomer.Id != 0)
     {
         model.DeleteCustomer(currentCustomer);
         RefreshList();
     }
 }
Example #4
0
        /// <summary>
        /// Delete customer by id
        /// </summary>
        public string DeleteCustomer(string id)
        {
            CustomerModel model = new CustomerModel();

            if (!String.IsNullOrWhiteSpace(id))
            {
                model.DeleteCustomer(Convert.ToInt32(id));
                return("Selected customer deleted sucessfully");
            }
            else
            {
                return("Invalid operation");
            }
        }
Example #5
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;
            }
        }
Example #6
0
        public bool DeleteCustomer()
        {
            string Phone = View.Phone;

            return(CustomerModel.DeleteCustomer(Phone));
        }