コード例 #1
0
 public static IO <IDeleteOrderResult> DeleteOrderFromDB(int orderID) =>
 from getOrder in RestaurantDomain.GetOrder(orderID)
 let order = (getOrder as OrderSelected)?.OrderAgg.Order
             from deleteOrder in DeleteOrder(order)
             let orderToDelete = (deleteOrder as OrderDeleted)?.Order
                                 from db in Database.DeleteEntity(orderToDelete)
                                 select deleteOrder;
コード例 #2
0
 public static IO <IDeleteMenuItemResult> DeleteMenuItemFromDB(string menuName, int menuID) =>
 from getMenuItem in RestaurantDomain.GetMenuItem(menuName, menuID)
 let menuItem = (getMenuItem as MenuItemSelected)?.MenuItemAgg.MenuItem
                from deleteMenuItem in DeleteMenuItem(menuItem)
                let menuItemToDelete = (deleteMenuItem as MenuItemDeleted)?.MenuItem
                                       from db in Database.DeleteEntity(menuItemToDelete)
                                       select deleteMenuItem;
コード例 #3
0
 // Create a Menu
 public static IO <MenuAgg> CreateMenuAndPersist(string name, Restaurant restaurant)
 => from menuCreated in RestaurantDomain.CreateMenu(name, restaurant)
 let agg = (menuCreated as CreateMenuResult.MenuCreated)?.Menu
           from db in Database.AddOrUpdate(agg.Menu)
           select agg;
コード例 #4
0
 // Create an Employee
 public static IO <EmployeeAgg> CreateEmployeeAndPersist(string firstName, string lastName, string email, string phone, string job, string username, string password, int restaurantId)
 => from employeeCreated in RestaurantDomain.CreateEmployee(firstName, lastName, email, phone, job, username, password, restaurantId)
 let agg = (employeeCreated as CreateEmployeeResult.EmployeeCreated)?.Employee
           from db in Database.AddOrUpdate(agg.Employee)
           select agg;
コード例 #5
0
 // Create a Client
 public static IO <ClientAgg> CreateClientAndPersist(string firstName, string lastName, string email, string phone, string cardNumber, string username, string password)
 => from clientCreated in RestaurantDomain.CreateClient(firstName, lastName, email, phone, cardNumber, username, password)
 let agg = (clientCreated as CreateClientResult.ClientCreated)?.Client
           from db in Database.AddOrUpdate(agg.Client)
           select agg;
コード例 #6
0
 // Get a Restaurant by name
 public static IO <RestaurantAgg> GetRestaurant(string name)
 => from restaurant in Database.Query <FindRestaurantQuery, Restaurant>(new FindRestaurantQuery(name))
 from getResult in RestaurantDomain.GetRestaurant(restaurant)
 let agg = (getResult as GetRestaurantResult.RestaurantFound)?.Agg
           select agg;
コード例 #7
0
 // Pay an Order
 public static IO <OrderAgg> PayOrderAndPersist(Client client, Order order, uint tip)
 => from orderPaid in RestaurantDomain.PayOrder(client, order, tip)
 let agg = (orderPaid as PayOrderResult.OrderPaid)?.Order
           from db in Database.AddOrUpdate(agg.Order)
           select agg;
コード例 #8
0
 // Create a payment request for an Order
 public static IO <OrderAgg> CreatePaymentRequestAndPersist(int orderId)
 => from order in Database.Query <FindOrderQuery, Order>(new FindOrderQuery(orderId))
 from requestCreated in RestaurantDomain.CreatePaymentRequest(order)
 let agg = (requestCreated as CreatePaymentRequestResult.PaymentOrderStatus)?.Order
           from db in Database.AddOrUpdate(agg.Order)
           select agg;
コード例 #9
0
 // Change a MenuItem
 public static IO <MenuItemAgg> ChangeMenuItemAndPersist(MenuItem menuItem, MenuItem newMenuItem)
 => from menuItemChanged in RestaurantDomain.ChangeMenuItem(menuItem, newMenuItem)
 let agg = (menuItemChanged as CreateMenuItemResult.MenuItemCreated)?.MenuItem
           from db in Database.AddOrUpdate(agg.MenuItem)
           select agg;
コード例 #10
0
 // Get Menu Items List for a specific Menu
 public static IO <List <MenuItem> > GetMenuItems(Menu menu)
 => from menuItems in Database.Query <FindMenuItemsQuery, List <MenuItem> >(new FindMenuItemsQuery(menu))
 from getResult in RestaurantDomain.GetMenuItems(menuItems)
 let agg = (getResult as GetMenuItemsResult.MenuItemsFound)?.MenuItems
           select agg;
コード例 #11
0
 // Get a MenuItem by Id
 public static IO <MenuItemAgg> GetMenuItem(int menuItemId)
 => from menuItem in Database.Query <FindMenuItemQuery, MenuItem>(new FindMenuItemQuery(menuItemId))
 from getResult in RestaurantDomain.GetMenuItem(menuItem)
 let agg = (getResult as GetMenuItemResult.MenuItemFound)?.Agg
           select agg;
コード例 #12
0
 // Create a MenuItem
 public static IO <MenuItemAgg> CreateMenuItemAndPersist(Menu menu, string name, string ingredients, string allergens, uint totalQuantity, decimal price, bool availability)
 => from menuItemCreated in RestaurantDomain.CreateMenuItem(menu, name, ingredients, allergens, totalQuantity, price, availability)
 let agg = (menuItemCreated as CreateMenuItemResult.MenuItemCreated)?.MenuItem
           from db in Database.AddOrUpdate(agg.MenuItem)
           select agg;
コード例 #13
0
 // Get Menus List from Restaurant
 public static IO <List <Menu> > GetMenus(Restaurant restaurant)
 => from menus in Database.Query <FindMenusQuery, List <Menu> >(new FindMenusQuery(restaurant))
 from getResult in RestaurantDomain.GetMenus(menus)
 let agg = (getResult as GetMenusResult.GetMenusSuccessful)?.Menus
           select agg;
コード例 #14
0
 public static IO <ICreateMenuItemResult> CreateAndPersistMenuItem(Menu menu, MenuItem menuItem) =>
 from menuItemCreated in RestaurantDomain.CreateMenuItem(menu, menuItem)
 let menuItemAgg = (menuItemCreated as MenuItemCreated)?.MenuItemAgg
                   from dbContext in Database.AddOrUpdateEntity(menuItemAgg.MenuItem)
                   select menuItemCreated;
コード例 #15
0
 //public static IO<ICreateMenuResult> CreateAndPersistMenu(int id, string name, String menuType, bool isVisible, String hours, Restaurant restaurant) =>
 //   from menuCreated in RestaurantDomain.CreateMenu(id, name, menuType, isVisible, hours, restaurant)
 public static IO <ICreateMenuResult> CreateAndPersistMenu(Menu menu, Restaurant restaurant) =>
 from menuCreated in RestaurantDomain.CreateMenu(menu, restaurant)
 let menuAgg = (menuCreated as MenuCreated)?.Menu
               from dbContext in Database.AddOrUpdateEntity(menuAgg.Menu)
               select menuCreated;
コード例 #16
0
 // Get status for a specific Order by Id
 public static IO <string> GetOrderStatus(int orderId)
 => from order in Database.Query <FindOrderQuery, Order>(new FindOrderQuery(orderId))
 from getResult in RestaurantDomain.GetOrderStatus(order)
 let status = (getResult as GetOrderStatusResult.GetOrderStatus)?.StatusMessage
              select status;
コード例 #17
0
 // Set status for a specific Order
 public static IO <OrderAgg> SetOrderStatusAndPersist(Order order, string orderStatus, TimeSpan preparationTime)
 => from statusCreated in RestaurantDomain.SetOrderStatus(order, orderStatus, preparationTime)
 let agg = (statusCreated as SetOrderStatusResult.SetOrderStatusSuccessful)?.Order
           from db in Database.AddOrUpdate(agg.Order)
           select agg;
コード例 #18
0
        // Add to Cart => Create an OrderItem

        /*public static IO<CreateOrderItemResult.IAddToCartResult> AddToCart(string sessionId, MenuItem menuItem, uint quantity, string specialRequests)
         *  => from orderItemCreated in RestaurantDomain.AddToCart(sessionId, menuItem, quantity, specialRequests)
         *     let agg = (orderItemCreated as CreateOrderItemResult.AddToCartSuccessful)?.OrderItem
         *     from db in Database.AddOrUpdate(agg.OrderItem)
         *     select orderItemCreated;*/

        // Place Order => Create an Order
        public static IO <OrderAgg> PlaceOrderAndPersist(Client client, Restaurant restaurant, decimal totalPrice, uint tableNumber)
        => from orderCreated in RestaurantDomain.PlaceOrder(client, restaurant, totalPrice, tableNumber)
        let agg = (orderCreated as PlaceOrderResult.OrderPlaced)?.Order
                  from db in Database.AddOrUpdate(agg.Order)
                  select agg;
コード例 #19
0
 // Check payment status for a specific Order
 public static IO <string> CheckOrderPaymentStatus(int orderId)
 => from order in Database.Query <FindOrderQuery, Order>(new FindOrderQuery(orderId))
 from getResult in RestaurantDomain.CheckOrderPaymentStatus(order)
 let status = (getResult as CheckOrderPaymentResult.CheckOrderPaymentStatus)?.PaymentStatus
              select status;
コード例 #20
0
 // Get an Order by Id
 public static IO <OrderAgg> GetOrder(int orderId)
 => from order in Database.Query <FindOrderQuery, Order>(new FindOrderQuery(orderId))
 from getResult in RestaurantDomain.GetOrder(order)
 let agg = (getResult as GetOrderResult.OrderFound)?.Agg
           select agg;
コード例 #21
0
 // Create a Restaurant
 public static IO <RestaurantAgg> CreateRestaurantAndPersist(string name, string address)
 => from restaurantCreated in RestaurantDomain.CreateRestaurant(name, address)
 let agg = (restaurantCreated as CreateRestaurantResult.RestaurantCreated)?.Restaurant
           from db in Database.AddOrUpdate(agg.Restaurant)
           select agg;
コード例 #22
0
 // Create an OrderItem
 public static IO <OrderItemAgg> CreateOrderItemAndPersist(CartItem cartItem, Order order)
 => from orderItemCreated in RestaurantDomain.CreateOrderItem(cartItem, order)
 let agg = (orderItemCreated as CreateOrderItemResult.OrderItemCreated)?.OrderItem
           from db in Database.AddOrUpdate(agg.OrderItem)
           select agg;
コード例 #23
0
 // Get all Restaurants
 public static IO <List <Restaurant> > GetRestaurants()
 => from restaurants in Database.Query <FindRestaurantsQuery, List <Restaurant> >(new FindRestaurantsQuery())
 from getResult in RestaurantDomain.GetRestaurants(restaurants)
 let agg = (getResult as GetRestaurantsResult.RestaurantsFound)?.Restaurants
           select agg;
コード例 #24
0
 // Get an OrderItem by Id
 public static IO <OrderItemAgg> GetOrderItem(int orderItemId)
 => from orderItem in Database.Query <FindOrderItemQuery, OrderItem>(new FindOrderItemQuery(orderItemId))
 from getResult in RestaurantDomain.GetOrderItem(orderItem)
 let agg = (getResult as GetOrderItemResult.OrderItemFound)?.Agg
           select agg;
コード例 #25
0
 // Get a Client by Id
 public static IO <ClientAgg> GetClient(string clientId)
 => from client in Database.Query <FindClientQuery, Client>(new FindClientQuery(clientId))
 from getResult in RestaurantDomain.GetClient(client)
 let agg = (getResult as GetClientResult.ClientFound)?.Agg
           select agg;
コード例 #26
0
 // Get Order Items from an Order
 public static IO <List <OrderItem> > GetOrderItems(Order order)
 => from orderItems in Database.Query <FindOrderItemsQuery, List <OrderItem> >(new FindOrderItemsQuery(order))
 from getResult in RestaurantDomain.GetOrderItems(orderItems)
 let agg = (getResult as GetOrderItemsResult.OrderItemsFound)?.OrderItems
           select agg;
コード例 #27
0
 // Get an Employee by Restaurant Id and Employee Id
 public static IO <EmployeeAgg> GetEmployee(int restaurantId, string employeeId)
 => from employee in Database.Query <FindEmployeeQuery, Employee>(new FindEmployeeQuery(restaurantId, employeeId))
 from getResult in RestaurantDomain.GetEmployee(employee)
 let agg = (getResult as GetEmployeeResult.EmployeeFound)?.Agg
           select agg;
コード例 #28
0
 // Change quantity of an OrderItem
 public static IO <OrderItemAgg> ChangeQuantityAndPersist(string sessionId, OrderItem orderItem, uint newQuantity)
 => from quantityChanged in RestaurantDomain.ChangeQuantity(sessionId, orderItem, newQuantity)
 let agg = (quantityChanged as ChangeQuantityResult.QuantityChanged)?.NewOrderItem
           from db in Database.AddOrUpdate(agg.OrderItem)
           select agg;
コード例 #29
0
 // Get a Menu by Id
 public static IO <MenuAgg> GetMenu(int menuId)
 => from menu in Database.Query <FindMenuQuery, Menu>(new FindMenuQuery(menuId))
 from getResult in RestaurantDomain.GetMenu(menu)
 let agg = (getResult as GetMenuResult.MenuFound)?.Agg
           select agg;
コード例 #30
0
 // Get Orders from a specific Client
 public static IO <List <Order> > GetClientOrders(int clientId)
 => from orders in Database.Query <FindClientOrdersQuery, List <Order> >(new FindClientOrdersQuery(clientId))
 from getResult in RestaurantDomain.GetOrders(orders)
 let agg = (getResult as GetOrdersResult.GetOrdersSuccessful)?.Orders
           select agg;