Example #1
0
        public IHttpActionResult Get([FromBody] PaymentSearch valPayment)
        {
            string vResult = "4";

            IPaymentData vPaymentData = new PaymentData();

            try {
                bool vNullField = VerifyNullFiledsSearch(valPayment);

                if (vNullField)
                {
                    vResult = "2";
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotAcceptable, new { Code = HttpStatusCode.NotAcceptable, Message = Messages.vListContainNullValue, Result = vResult })));
                }

                string vResponse = vPaymentData.SelectById(valPayment);

                if (!string.IsNullOrEmpty(vResponse))
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { Code = HttpStatusCode.OK, Message = Messages.vOkListed, Result = vResponse })));
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, new { Code = HttpStatusCode.InternalServerError, Message = Messages.vInternalServerError, Result = vResult })));
            }
            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { Code = HttpStatusCode.OK, Message = Messages.vNotListed, Result = vResult })));
        }