Beispiel #1
0
        public async Task <IActionResult> GetEmployee(string restaurantName, string employeeId)
        {
            var getRestaurantExpr =
                from restaurantResult in RestaurantDomain.GetRestaurant(restaurantName)
                select restaurantResult;
            var restaurant = await _interpreter.Interpret(getRestaurantExpr, Unit.Default);

            var getRestaurant =
                from restaurantResult in RestaurantDomainEx.GetRestaurant(restaurantName)
                select restaurantResult;
            var restaurantAgg = await _interpreter.Interpret(getRestaurant, Unit.Default);

            var getEmployeeExpr =
                from employeeResult in RestaurantDomain.GetEmployee(restaurantAgg.Restaurant.Id, employeeId)
                select employeeResult;
            var employee = await _interpreter.Interpret(getEmployeeExpr, Unit.Default);

            return(restaurant.Match(
                       found => (IActionResult)Ok(found.Agg.Restaurant),
                       notFound => NotFound()));
        }