Ejemplo n.º 1
0
 public ActionResult Update(客戶資料[] Customers, int PageIndex)
 {
     if (ModelState.IsValid)
     {
         foreach (客戶資料 data in Customers)
         {
             if (!data.IsDelete)
             {
                 data.IsDelete = false;
             }
             else
             {
                 data.是否已刪除 = !data.是否已刪除;
             }
             this.customerRepository.UnitOfWork.Context.Entry(data).State = EntityState.Modified;
         }
         this.customerRepository.UnitOfWork.Commit();
         return RedirectToAction("Index", new { PageIndex });
     }
     else
     {
         CustomerViewModel model = new CustomerViewModel();
         model.PageIndex = PageIndex;
         model.Customers = this.customerRepository.PagedToList(PageIndex, pageNum);
         return View("Index", model);
     }
 }
Ejemplo n.º 2
0
 // GET: /Customers/
 public ActionResult Index(CustomerViewModel model)
 {
     model.Customers = this.customerRepository.PagedToList(model.PageIndex, pageNum);
     return View(model);
 }