private Receipt CreateAndGetReceipt(bool merge = false) { var waiter = _context.ApplicationUsers.First(); var table = _context.Tables.First(); var cafe = _context.Cafes.First(); var priceTableQueries = cafe.PriceTable.PriceTableQueries.ToList(); var receipt = new ReceiptDto() { Cafe = cafe, Table = table, Waiter = waiter, ReceiptPriceTableQueries = new List <ReceiptPriceTableQuery>() { new ReceiptPriceTableQuery() { PriceTableQueryId = priceTableQueries[0].Id, Quantity = 2 }, new ReceiptPriceTableQuery() { PriceTableQueryId = priceTableQueries[1].Id, Quantity = 1 }, new ReceiptPriceTableQuery() { PriceTableQueryId = merge ? priceTableQueries[0].Id : priceTableQueries[2].Id, Quantity = 4 }, } }; _receiptOperations.CreateReceipt(receipt); return(_context.Receipts.Last()); }
public IActionResult CreateReceipt([FromBody] ReceiptDto receipt) { _receiptOperations.CreateReceipt(receipt); return(NoContent()); }