Creating RSS feed in ASP.net mvc3

In this toturial we are going through steps to create rss feed from a list of items using .NET’s built in SyndicatedFeed and SyndicatedItem class for content and two classes (Rss20FeedFormatter and Atom10FeedFormatter )  to handle XML generation with correct encoding, formatting and optional fields.

  1. Create an empty mvc3 application and name it “RSSFeed.Website” then add Home controller.
  2. Create a class and name it NewsItem  this class we will be used as a model for retrieving feed data from the database “i will fill it manually in a the next step ”
  3. Optional step, Fill in NewsItem list if you have items in database so there is no need to fill the list like that you can get the data from the database and return it in a list of items
  4. We have to build our FeedResult class
  5. We almost done we have to create our rss page so we are going to create an ActionResult called NewsRss in HomeController
  6. we are done now except just putting a link to home to open up our RSS

You can download a sample from here

 

nopcommerce: How to get Role Name from applied discount coupon?

– Create a discount from the cms admin

– Add  a requirement for that discount and select “Must be assigned to customer role” and choose a role.

The next steps can be done anywhere in the website, I will use the CommonController to show the role name inside the website header beside the user email

–  Go to CommonController  and inside the HeaderLinks method add these lines:

So the method will look like this

 

– You will need to declare the _discountService, so declare it in the Fields region

and then initialize it in the controller constructor:

– Add DiscountRoleName property inside the HeaderLinksModel

– Inside the HeaderLinks view, inside the IsAuthinticated check, add this:

– Login to the store and apply a coupon code you just created, you will see the role name of this applied discount coupon in the header.