public ActionResult DeleteConfirmed(int id) { CustomerTV customerTV = db.CustomerTVs.Find(id); db.CustomerTVs.Remove(customerTV); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CustomerID,Name,Birthday,Phone,Email,Gender,CumilativePoint,Address")] CustomerTV customerTV) { if (ModelState.IsValid) { db.Entry(customerTV).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTV)); }
public ActionResult Create([Bind(Include = "CustomerID,Name,Birthday,Phone,Email,Gender,CumilativePoint,Address")] CustomerTV customerTV) { if (ModelState.IsValid) { db.CustomerTVs.Add(customerTV); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTV)); }
// GET: CustomerTVs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTV customerTV = db.CustomerTVs.Find(id); if (customerTV == null) { return(HttpNotFound()); } return(View(customerTV)); }
public ActionResult GetCustomerById(int customerId) { CustomerTV customer = db.CustomerTVs.Where(x => x.CustomerID.Equals(customerId)).SingleOrDefault(); bool status = false; if (!(customer == null)) { status = true; } else { customer = new CustomerTV(); } return(Json(new { Status = status, CustomerId = customer.CustomerID, Name = customer.Name, Phone = customer.Phone, Email = customer.Email, Gender = customer.Gender }, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateJSON(CustomerTV customerTV) { db.CustomerTVs.Add(customerTV); db.SaveChanges(); return(Json(new { status = true, customerID = customerTV.CustomerID }, JsonRequestBehavior.AllowGet)); }