/// <summary> /// Could persist this event on Database -> this will update the product as inactive /// </summary> /// <param name="e"></param> protected virtual void OnLowStock(LowStockChangeObjectEventArgs e) { EventHandler <LowStockChangeObjectEventArgs> handler = UpdateProduct; if (handler != null) { handler(this, e); } }
/// <summary> /// Remove Item from showcase /// It could send to the queue to update the Showcase bounded context /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateShowCase(object sender, LowStockChangeObjectEventArgs e) { Console.WriteLine($"Id: {id} - Updating item {e.ProductName} on Showcase"); }
/// <summary> /// Will persist Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateDatabase(object sender, LowStockChangeObjectEventArgs e) { Console.WriteLine($"Id: {id} - Update item {e.ProductName} on Database"); }
/// <summary> /// Will persist Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateRedisCache(object sender, LowStockChangeObjectEventArgs e) { Console.WriteLine($"Id: {id} - Updating item {e.ProductName} on Redis Cache"); }