diff --git a/OrdrMate/Features/CashierOrder/CashierOrder.Service.cs b/OrdrMate/Features/CashierOrder/CashierOrder.Service.cs index 40b254b..0a3176d 100644 --- a/OrdrMate/Features/CashierOrder/CashierOrder.Service.cs +++ b/OrdrMate/Features/CashierOrder/CashierOrder.Service.cs @@ -1,6 +1,8 @@ using OrdrMate.Services; using OrdrMate.DTOs.Order; using OrdrMate.Enums; +using OrdrMate.Models; +using OrdrMate.Repositories; using OrdrMate.Features.BranchAttendance; namespace OrdrMate.Features.CashierOrder; @@ -9,11 +11,13 @@ public class CashierOrderService { private readonly OrderService _orderService; private readonly BranchAttendanceService _branchAttendanceService; + private readonly IOrderRepo _orderRepo; - public CashierOrderService(OrderService orderService, BranchAttendanceService branchAttendanceService) + public CashierOrderService(OrderService orderService, BranchAttendanceService branchAttendanceService, IOrderRepo orderRepo) { _orderService = orderService; _branchAttendanceService = branchAttendanceService; + _orderRepo = orderRepo; } public async Task CreateOrderForCashier(PlaceOrderDto placeOrderDto) @@ -35,4 +39,16 @@ public async Task CreateOrderForCashier(PlaceOrderDto placeOrder return orderIntent; } + public async Task CreateGroupedOrderForTable(string tableId, List items, string cashierId) + { + var order = new Order + { + TableReservationId = tableId, + OrderItems = items, + OrderDate = DateTime.UtcNow, + Status = OrderStatus.Pending, + }; + + return await _orderRepo.CreateOrder(order); + } } diff --git a/OrdrMate/Repositories/OrderRepo.cs b/OrdrMate/Repositories/OrderRepo.cs index 1cb16f5..e05149d 100644 --- a/OrdrMate/Repositories/OrderRepo.cs +++ b/OrdrMate/Repositories/OrderRepo.cs @@ -1,5 +1,4 @@ namespace OrdrMate.Repositories; - using OrdrMate.Models; using OrdrMate.Data; using Microsoft.EntityFrameworkCore;