コード例 #1
0
        public ActionResult DeleteSalesOrder(int salesOrderId)
        {
            ActionResult result = new OkResult();

            SalesOrder salesOrder = salesOrdersService.ReadSalesOrderById(salesOrderId);

            if (salesOrder != null)
            {
                salesOrdersService.DeleteSalesOrder(salesOrder);
            }
            else
            {
                result = new NotFoundResult();
            }

            return(result);
        }
        public ActionResult Put([FromBody] CardInfo cardInfo, int salesOrderId)
        {
            ActionResult result     = new OkResult();
            SalesOrder   salesOrder = salesOrdersService.ReadSalesOrderById(salesOrderId);

            if (salesOrder != null)
            {
                string authorizationCode = salesOrderManager.CompletePurchase(salesOrder, cardInfo);

                if (authorizationCode != null)
                {
                    salesOrder.CardNumber  = cardInfo.Number;
                    salesOrder.CardExpires = cardInfo.Expires;
                    salesOrder.Filled      = DateTime.Now;
                    salesOrdersService.UpdateSalesOrder(salesOrder);
                }
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }