public ActionResult delete(int id) { var query = (from customerdata in customerObject.tblCustomers where customerdata.id == id select customerdata).Single(); customerObject.tblCustomers.DeleteOnSubmit(query); customerObject.SubmitChanges(); Response.Redirect("/customer/index"); return(View()); }
public static void Delete(string customerID) { CustomerDataContext context = new CustomerDataContext(); Customer cust = context.Customers.Single(c => c.CustomerID == customerID); context.Customers.DeleteOnSubmit(cust); context.SubmitChanges(); }
public ActionResult delete(int id) { var role = RouteData.Values["role"].ToString(); ViewBag.role = role; ViewBag.layout = "~/Views/Shared/_" + role + "Layout.cshtml"; var query = (from customerdata in customerObject.tblCustomers where customerdata.id == id select customerdata).Single(); customerObject.tblCustomers.DeleteOnSubmit(query); customerObject.SubmitChanges(); var redirectUrl = "/profile/" + role + "/customer/index"; Response.Redirect(redirectUrl); return(View()); }
public static Customer Create(Customer newCustomer) { CustomerDataContext context = new CustomerDataContext(); context.Customers.InsertOnSubmit(newCustomer); context.SubmitChanges(); Customer cust = context.Customers.Single(c => c.CustomerID == newCustomer.CustomerID); return(cust); }
public static void Update(Customer customer, string customerID) { CustomerDataContext context = new CustomerDataContext(); Customer cust = context.Customers.Single(c => c.CustomerID == customer.CustomerID); cust.CustomerID = customer.CustomerID; cust.Address = customer.Address; cust.City = customer.City; cust.CompanyName = customer.CompanyName; cust.ContactName = customer.ContactName; cust.ContactTitle = customer.ContactTitle; cust.Country = customer.Country; cust.Fax = customer.Fax; cust.Phone = customer.Phone; cust.PostalCode = customer.PostalCode; cust.Region = customer.Region; context.SubmitChanges(); }