private int GetPastry(int quantity) { bool orderRequired; try { return(_pastryService.Get(quantity)); } catch (ArgumentException) { orderRequired = true; } if (orderRequired) { _logger.Information("Ordering pastry. {CodeInfo}", GetCodeInfo()); _pastryService.Order(); try { return(_pastryService.Get(quantity)); } catch (Exception e) { _logger.Error(e, "Unable to get {Quantity} of pastry. {CodeInfo}", quantity, GetCodeInfo()); return(0); } } return(0); }
public async Task <PieRecord> GetPieRecord(string flavour) { int pastry = _pastryService.Get(50); int filling = _fillingService.Get(flavour, 50); Pie pie = await _pieDataService.BakePie(flavour, pastry, filling); List <Pie> pieAudit = await _pieDataService.GetPieAudit(); return(new PieRecord { MostRecent = pie, PieAudit = pieAudit }); }