Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            客戶分類 客戶分類 = this.repo.Find(id);

            this.repo.Delete(客戶分類);
            this.repo.UnitOfWork.Commit();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            客戶分類 客戶分類 = db.客戶分類.Find(id);

            客戶分類.IsDelete = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            客戶分類 category = categoryRepo.Find(id);

            categoryRepo.Delete(category);
            categoryRepo.UnitOfWork.Commit();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,客戶分類名稱,IsDelete")] 客戶分類 客戶分類)
 {
     if (ModelState.IsValid)
     {
         db.Entry(客戶分類).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(客戶分類));
 }
        public ActionResult Create([Bind(Include = "Id,客戶分類名稱,IsDelete")] 客戶分類 客戶分類)
        {
            if (ModelState.IsValid)
            {
                db.客戶分類.Add(客戶分類);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(客戶分類));
        }
Exemple #6
0
        public ActionResult Create(客戶分類 customerCategory)
        {
            if (ModelState.IsValid)
            {
                repo.Add(customerCategory);
                repo.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(customerCategory));
        }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "Id,分類")] 客戶分類 客戶分類)
 {
     if (ModelState.IsValid)
     {
         客戶分類repo.Update(客戶分類);
         客戶分類repo.UnitOfWork.Commit();
         return(RedirectToAction("Index"));
     }
     //    ViewBag.客戶分類Id = new SelectList(客戶分類repo.All(), "Id", "客戶分類", 客戶分類.Id);
     return(View(客戶分類));
 }
        public ActionResult Edit([Bind(Include = "Id,分類名稱")] 客戶分類 category)
        {
            if (ModelState.IsValid)
            {
                categoryRepo.UnitOfWork.Context.Entry(category).State = EntityState.Modified;
                categoryRepo.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
        public ActionResult Create([Bind(Include = "Id,分類名稱")] 客戶分類 category)
        {
            if (ModelState.IsValid)
            {
                categoryRepo.Add(category);
                categoryRepo.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
        // GET: 客戶分類/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶分類 客戶分類 = db.客戶分類.Find(id);

            if (客戶分類 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶分類));
        }
Exemple #11
0
        public ActionResult Create([Bind(Include = "Id,分類名稱,Is刪除")] 客戶分類 客戶分類)
        {
            if (ModelState.IsValid)
            {
                //db.客戶分類.Add(客戶分類);
                //db.SaveChanges();
                this.repo.Add(客戶分類);
                this.repo.UnitOfWork.Commit();

                return(RedirectToAction("Index"));
            }

            return(View(客戶分類));
        }
Exemple #12
0
        public ActionResult Edit(int id, 客戶分類 customerCategory)
        {
            var data = repo.All().Where(p => p.Id == id).FirstOrDefault();

            if (ModelState.IsValid)
            {
                data.InjectFrom(customerCategory);

                repo.UnitOfWork.Commit();

                return(RedirectToAction("Index"));
            }

            return(View(data));
        }
Exemple #13
0
        // GET: 客戶分類/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶分類 客戶分類 = 客戶分類repo.Get單筆資料ById(id.Value);

            if (客戶分類 == null)
            {
                return(HttpNotFound());
            }

            return(View(客戶分類));
        }
Exemple #14
0
        // GET: 客戶分類/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            客戶分類 客戶分類 = 客戶分類repo.Get單筆資料ById(id.Value);

            if (客戶分類 == null)
            {
                return(HttpNotFound());
            }
            //    ViewBag.客戶分類Id = new  SelectList(客戶分類repo.All(), "Id", "客戶分類", 客戶分類.Id);
            return(View(客戶分類));
        }
Exemple #15
0
        // GET: 客戶分類/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //客戶分類 客戶分類 = db.客戶分類.find(id);
            客戶分類 客戶分類 = this.repo.Find(id.Value);

            if (客戶分類 == null)
            {
                return(HttpNotFound());
            }
            return(View(客戶分類));
        }
        // GET: Categories/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            客戶分類 category = categoryRepo.Find(id.Value);

            if (category == null)
            {
                return(HttpNotFound());
            }

            return(View(category));
        }