コード例 #1
0
 public ActionResult Update(客戶聯絡人[] Contacts, int PageIndex)
 {
     if (ModelState.IsValid)
     {
         foreach (客戶聯絡人 data in Contacts)
         {
             if (!data.IsDelete)
             {
                 data.IsDelete = false;
                 }
             else
             {
                 data.是否已刪除 = !data.是否已刪除;
             }
             this.contactRepository.UnitOfWork.Context.Entry(data).State = EntityState.Modified;
         }
         this.contactRepository.UnitOfWork.Commit();
         return RedirectToAction("Index", new { PageIndex });
     }
     else
     {
         ContactViewModel model = new ContactViewModel();
         model.PageIndex = PageIndex;
         model.Contacts = this.contactRepository.PagedToList(PageIndex, pageNum);
         model.Customers = this.customerRepository.All();
         return View("Index", model);
     }
 }
コード例 #2
0
 // GET: /Contacts/
 public ActionResult Index(ContactViewModel model)
 {
     model.Contacts = this.contactRepository.PagedToList(model.PageIndex, pageNum);
     model.Customers = this.customerRepository.All();
     return View(model);
 }