Пример #1
0
        public async Task <string> CheckOut([FromBody] string json)
        {
            var parser                 = new Parser(json);
            var pseudoCart             = parser.AsObject <PseudoCart>("PseudoCart");
            var name                   = parser.AsString("Name");
            var address                = parser.AsString("Address");
            var phone                  = parser.AsString("Phone");
            var alternateName          = parser.AsString("AlternateName");
            var alternateAddress       = parser.AsString("AlternateAddress");
            var alternatePhone         = parser.AsString("AlternatePhone");
            var paymentMethod          = parser.AsInt("PaymentMethod");
            var sendToDifferentAddress = parser.AsBool("SendToDifferentAddress");
            var note                   = parser.AsString("Note");

//            var eCart = await FromPseudo(pseudoCart);

            var checkOutResult = await _iCheckoutRepository.CheckOut(pseudoCart, name, address, phone, sendToDifferentAddress, alternateName,
                                                                     alternateAddress, alternatePhone, paymentMethod, note);

            // the real cart is not necessary
            checkOutResult.ECart = null;
            object result = new
            {
                Result = checkOutResult
            };

            return(JsonConvert.SerializeObject(result, new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Include,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            }));
        }