コード例 #1
0
        public async Task <IActionResult> DeteleOrder(int orderID)
        {
            var expr = from deleteOrder in RestaurantDomain.DeleteOrderFromDB(orderID)
                       let order = (deleteOrder as OrderDeleted)?.Order
                                   select deleteOrder;

            var result = await interpreter.Interpret(expr, Unit.Default);

            return(await result.MatchAsync <IActionResult>(

                       async (deleted) =>
            {
                return (IActionResult)Ok(deleted.Order);
            },
                       async (notDeleted) =>
            {
                return BadRequest();
            }

                       ));
        }