Example #1
0
        public void Validate()
        {
            List <string> widgets = widgetRepository.FetchWidgets();

            if (!widgets.Any())
            {
                throw new BusinessLogicValidationFailedException();
            }
            Console.WriteLine("Business Logic has validated the wdigets.");
        }
Example #2
0
        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());
        }
Example #3
0
        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);
 }