Ejemplo n.º 1
0
        public PaymentSaveResponse SavePayment([FromForm] PaymentInfo paymentInfo)
        {
            log.Info("Enter SavePayment");
            PaymentSaveResponse psr = null;

            if (ModelState.IsValid)
            {
                log.Info("ModelState is valid, begin to save");
                var result = Saver.SavePaymentInfo(paymentInfo);

                psr = new PaymentSaveResponse
                {
                    Success = result.Success,
                    Errors  = result.Information
                };
            }
            else
            {
                log.Info("Model is NOT valid, return message.");
                psr = new PaymentSaveResponse
                {
                    Success = false,
                    Errors  = new List <string> {
                        "Invalid Fields"
                    }
                };
            }

            return(psr);
        }