Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerTV customerTV = db.CustomerTVs.Find(id);

            db.CustomerTVs.Remove(customerTV);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        // 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));
        }
Exemple #5
0
        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));
        }
Exemple #6
0
 public ActionResult CreateJSON(CustomerTV customerTV)
 {
     db.CustomerTVs.Add(customerTV);
     db.SaveChanges();
     return(Json(new { status = true, customerID = customerTV.CustomerID }, JsonRequestBehavior.AllowGet));
 }