public IHttpActionResult Get(long id)
        {
            QueryResponse objQueryResponse;

            if (ModelState.IsValid)
            {
                try
                {
                    ContactInfoRESTfulRepository objContactInfoRESTfulRepository = new ContactInfoRESTfulRepository();
                    ContactInfoData objContactInfoData = objContactInfoRESTfulRepository.Query(id);
                    if (null == objContactInfoData)
                    {
                        objQueryResponse = new QueryResponse()
                        {
                            Result = $"{ MsgFail } : No Data"
                        };
                    }
                    else
                    {
                        objQueryResponse = new QueryResponse()
                        {
                            Result = MsgSuccess, Data = objContactInfoData
                        };
                    }
                }
                catch (Exception ex)
                {
                    objQueryResponse = new QueryResponse()
                    {
                        Result = $"{MsgException} : {ex.Message}"
                    };
                }

                //return Ok(objQueryResponse);
            }
            else
            {
                //return BadRequest(ModelState);

                string strErrorMsg = string.Empty;
                foreach (var item in ModelState.Values)
                {
                    strErrorMsg += string.Join(",", item.Errors.Select(e => e.ErrorMessage));
                }
                objQueryResponse = new QueryResponse()
                {
                    Result = string.IsNullOrWhiteSpace(strErrorMsg) ? "Request Format Error" : strErrorMsg
                };
            }

            //轉換JSON格式回傳
            HttpResponseMessage result = new HttpResponseMessage {
                Content = new StringContent(Utility.GetJSON(objQueryResponse), Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(ResponseMessage(result));
        }
        public IHttpActionResult Post([FromBody] AddRequest objAddRequest)
        {
            AddResponse objAddResponse;

            if (null != objAddRequest && ModelState.IsValid)
            {
                try
                {
                    ContactInfoData objContactInfoData = new ContactInfoData();
                    objContactInfoData.Name     = objAddRequest.Name.Trim();
                    objContactInfoData.Nickname = (!string.IsNullOrWhiteSpace(objAddRequest.Nickname) ? objAddRequest.Nickname.Trim() : null);
                    objContactInfoData.Gender   = (ContactInfoData.EnumGender?)objAddRequest.Gender;
                    objContactInfoData.Age      = objAddRequest.Age;
                    objContactInfoData.PhoneNo  = objAddRequest.PhoneNo.Trim();
                    objContactInfoData.Address  = objAddRequest.Address.Trim();

                    ContactInfoRESTfulRepository objContactInfoRESTfulRepository = new ContactInfoRESTfulRepository();
                    bool bolResult = objContactInfoRESTfulRepository.Insert(objContactInfoData);
                    if (bolResult)
                    {
                        objAddResponse = new AddResponse()
                        {
                            Result = MsgSuccess, Data = objContactInfoData
                        };
                    }
                    else
                    {
                        objAddResponse = new AddResponse()
                        {
                            Result = $"{MsgFail} : Insert Data Error"
                        };
                    }
                }
                catch (Exception ex)
                {
                    objAddResponse = new AddResponse()
                    {
                        Result = $"{MsgException} : {ex.Message}"
                    };
                }

                //return Ok(objAddResponse);
            }
            else
            {
                //return BadRequest(ModelState);

                string strErrorMsg = string.Empty;
                foreach (var item in ModelState.Values)
                {
                    strErrorMsg += string.Join(",", item.Errors.Select(e => e.ErrorMessage));
                }
                objAddResponse = new AddResponse()
                {
                    Result = string.IsNullOrWhiteSpace(strErrorMsg) ? "Request Format Error" : strErrorMsg
                };
            }

            //轉換JSON格式回傳
            HttpResponseMessage result = new HttpResponseMessage {
                Content = new StringContent(Utility.GetJSON(objAddResponse), Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(ResponseMessage(result));
        }