Пример #1
0
        public HttpResponseMessage Pay(PaymentPayRequestModel model)
        {
            PaymentPayResponseModel responseModel   = new PaymentPayResponseModel();
            HttpResponseMessage     responseMessage = new HttpResponseMessage();

            if (!ModelState.IsValid)
            {
                responseModel.IsSuccess    = false;
                responseModel.Message      = "False request for payment";
                responseMessage.StatusCode = HttpStatusCode.BadRequest;
                responseMessage.Content    = new StringContent(JsonConvert.SerializeObject(responseModel));
                return(responseMessage);
            }
            responseModel              = PaymentDB.Pay(model);
            responseMessage.Content    = new StringContent(JsonConvert.SerializeObject(responseModel));
            responseMessage.StatusCode = HttpStatusCode.Accepted;
            return(responseMessage);
        }