public IHttpActionResult Post(Interview.Models.Container.ClientData clientData, string editType)
        {
            //前台有檢查但後台還是再檢查一次好了
            string errorMsg = string.Empty;

            if (string.IsNullOrWhiteSpace(clientData.ClientName))
            {
                errorMsg += "請填客戶姓名、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Sex.ToString()))
            {
                errorMsg += "請選擇客戶性別、";
            }

            if (string.IsNullOrWhiteSpace(clientData.City.ToString()))
            {
                errorMsg += "請選擇縣市、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Address))
            {
                errorMsg += "請輸入地址、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Budget))
            {
                errorMsg += "請輸入預算、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Mobile))
            {
                errorMsg += "請輸入手機號碼、";
            }

            if (!string.IsNullOrWhiteSpace(errorMsg))
            {
                return(Ok(new { status = -1, message = errorMsg.Trim('、') }));
            }

            string result = string.Empty;

            try
            {
                if (editType == "新增")
                {
                    if (ClientData.Insert(clientData))
                    {
                        result = "新增成功";
                    }
                    else
                    {
                        result = "新增失敗";
                    }
                }
                else
                {
                    if (ClientData.Update(clientData))
                    {
                        result = "編輯成功";
                    }
                    else
                    {
                        result = "編輯失敗";
                    }
                }
                return(Ok(new { status = 1, message = result }));
            }
            catch
            {
                return(Ok(new { status = 0, message = "失敗" }));
            }
        }
        public ActionResult Edit(Interview.Models.Container.ClientData clientData, string editType)
        {
            //前台有檢查但後台還是再檢查一次好了
            string errorMsg = string.Empty;

            if (string.IsNullOrWhiteSpace(clientData.ClientName))
            {
                errorMsg += "請填客戶姓名、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Sex.ToString()))
            {
                errorMsg += "請選擇客戶性別、";
            }

            if (string.IsNullOrWhiteSpace(clientData.City.ToString()))
            {
                errorMsg += "請選擇縣市、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Address))
            {
                errorMsg += "請輸入地址、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Budget))
            {
                errorMsg += "請輸入預算、";
            }

            if (string.IsNullOrWhiteSpace(clientData.Mobile))
            {
                errorMsg += "請輸入手機號碼、";
            }

            if (!string.IsNullOrWhiteSpace(errorMsg))
            {
                TempData["Message"] = errorMsg.Trim('、');
                return(RedirectToAction("Edit"));
            }


            string result = string.Empty;

            try
            {
                if (editType == "新增")
                {
                    if (ClientData.Insert(clientData))
                    {
                        result = "新增成功";
                    }
                    else
                    {
                        result = "新增失敗";
                    }
                }
                else
                {
                    if (ClientData.Update(clientData))
                    {
                        result = "編輯成功";
                    }
                    else
                    {
                        result = "編輯失敗";
                    }
                }
                TempData["Message"] = result;
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }