Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1096939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:21:19+00:00 2026-05-17T00:21:19+00:00

I’m sorry this question is going to be a bit vague because I’m not

  • 0

I’m sorry this question is going to be a bit vague because I’m not entirely sure what I’m looking for.

Basically in my (Asp.net MVC) web app I have some basic (manually coded) workflow triggered by my various user inputs.

I need to send email configurable notifications when certain events happen.

For example, there is an update status method in my controller, which I could write something like this:

public ActionResult UpdateStatus(int id, Status status)
{
    Orders order = _orders.GetById(id);
    order.Status = status;

    if (status = Status.AwaitingApproval)
    {
        SendAwaitingApprovalNotification(_roles.GetApproverForDept(order.Department));
    }

    else if (status = Status.Approved && order.Department = someDept) { ... }

    else if (status = Status.Approved && order.Department = someOtherDept) { ... }

    else if // ... etc
}

As you can see, this is all going to get messy very quickly. And also, the logic for when/what notifications are sent is coded into the controller, which doesn’t feel right to me.

Also, there are various other actions which can change the state without specifically calling the UpdateStatus method. eg

public ActionResult ChangeOrderCost(int id, decimal newCost)
{
    Orders order = _orders.GetById(id);
    order.Cost = newCost;
    order.Status = Status.AwaitingCustomerApproval;
}

These are just made up examples but I hope you get the idea.

What I’m really thinking is that all my notification rules should be self-contained in some kind of configurable notication class, which basically monitors state changes on my object and does whatever it needs to do, so it acts like a plugin to the main application and maintains loose coupling. At the same time, I don’t really feel like my underlying data objects should have dependencies on things like notification services, I kind of think this should plug-in to my main controller classes.

I can’t really think how to achieve this, but I’m guessing it must be a common problem. Is there a specific design pattern I can read up on to give some clues? Has anyone done something like this before? Am I even thinking about this problem correctly? I’m pretty new to all this stuff but trying to think and code the correct way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:21:19+00:00Added an answer on May 17, 2026 at 12:21 am

    I would advise Chain-Of-Responsibility pattern:
    http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern

    It is basically a chain in which each element acts/doesn’t act based on the test condition implemented by it. These conditions can be made configurable but it is down to your implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.