public ActionResult deleteThis() { CustomerModel deleteMe = new CustomerModel(); deleteMe.DeleteCustomer(int.Parse(Request.Form["ID"])); return(Redirect("Customer")); }
// 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")); } }
public void Delete() { if (currentCustomer.Id != 0) { model.DeleteCustomer(currentCustomer); RefreshList(); } }
/// <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"); } }
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; } }
public bool DeleteCustomer() { string Phone = View.Phone; return(CustomerModel.DeleteCustomer(Phone)); }