public void Validate() { List <string> widgets = widgetRepository.FetchWidgets(); if (!widgets.Any()) { throw new BusinessLogicValidationFailedException(); } Console.WriteLine("Business Logic has validated the wdigets."); }
public ActionResult About() { // Let's make a payment when the user visits the about page! string myWidget = widgetRepository.FetchWidgets().Last(); paymentService.MakePaymentForWidget(myWidget); ViewBag.Message = string.Format("Payment made for the '{0}' widget!", myWidget); return(View()); }
public void Run() { businessLogic.Validate(); List <string> widgets = widgetRepository.FetchWidgets(); gizmoRepository.Get(); gizmoRepository.Get(); gizmoRepository.Get(); paymentService.MakePaymentForWidget(widgets.First()); }
public List <string> FetchWidgets() { if (_widgets == null) { _widgets = widgetRepository.FetchWidgets(); } else { Console.WriteLine("Using cached widgets!"); } return(_widgets); }