예제 #1
0
        public ActionResult Create([Bind(Include = "Id,客戶Id,職稱,姓名,Email,手機,電話")] 客戶聯絡人 ContactData)
        {
            if (repoClientContactData.CheckEmailIsDuplicate(ContactData))
            {
                return(View(ContactData));
            }

            if (ModelState.IsValid)
            {
                repoClientContactData.Add(ContactData);
                repoClientContactData.UnitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            ViewBag.客戶Id = new SelectList(repoClientInfo.All(), "Id", "客戶名稱", ContactData.客戶Id);
            return(View(ContactData));
        }