// This function will get triggered/executed when a new message is written // on an Azure Queue called orders. public static void ProcessQueueMessage([QueueTrigger("orders")] string message, TextWriter log) { IOrderRepository repoOrder = new OrderRepository(); IOrderQueueRepository repoOrderQueue = new OrderQueueRepository(); IUserRepository repoUser = new UserRepository(); OrderService os = new OrderService(repoOrder, repoOrderQueue); Order orderInfo = JsonConvert.DeserializeObject<Order>(message); os.saveOrder(orderInfo); UserService us = new UserService(repoUser); ClientMail mailclient = new ClientMail(); mailclient.SendMail(us.getAppUser(orderInfo.Gebruiker.ID), orderInfo); }
public void Setup() { new SetupDatabase().InitializeDatabase(new ApplicationDbContext()); repoProduct = new ProductRepository(); repoBasket = new BasketRepository(); repoOrderQueue = new OrderQueueRepository(); repoFm = new GenericRepository<Framework>(); repoOs = new GenericRepository<OS>(); repoUser = new UserRepository(); productService = new ProductService(repoFm, repoOs, repoProduct, repoBasket); basketService = new BasketService(repoBasket); userservice = new UserService(repoUser); languageservice = new LanguageService(); controller = new ProductController(productService); catController = new CataloogController(productService, basketService, userservice, languageservice); }