Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion OrdrMate/Features/CashierOrder/CashierOrder.Service.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<OrderIntentDto> CreateOrderForCashier(PlaceOrderDto placeOrderDto)
Expand All @@ -35,4 +39,16 @@ public async Task<OrderIntentDto> CreateOrderForCashier(PlaceOrderDto placeOrder

return orderIntent;
}
public async Task<Order> CreateGroupedOrderForTable(string tableId, List<OrderItem> items, string cashierId)
{
var order = new Order
{
TableReservationId = tableId,
OrderItems = items,
OrderDate = DateTime.UtcNow,
Status = OrderStatus.Pending,
};

return await _orderRepo.CreateOrder(order);
}
}
1 change: 0 additions & 1 deletion OrdrMate/Repositories/OrderRepo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
namespace OrdrMate.Repositories;

using OrdrMate.Models;
using OrdrMate.Data;
using Microsoft.EntityFrameworkCore;
Expand Down