ASP.NET MVC 3 Sample Application


Here is an ASP.NET MVC 3 sample web site to let ASP.NET MVC learners see how a real application is developed and works. This will be the first version of the app so more versions are lined up to emerge.

This ASP.NET MVC application is intended to be as simple as possible so you have to know that it is not such a comprehensive commercial application. The database, user interface and code snippets are tend to be concise and clear. Next versions will cover the utilization of Ajax and Asp.NET MVC UI controls.

What is this application about?

WebAdvert is an online advertisement web site. Basically users can sign up and issue their own adverts. They also will be able to manage (view/edit/delete) the ads. Anonymous users can browse the existing ads. Finally, administrators can view/create/delete the members and also assign them to the “Admins” role if necessary.

WebAdvert uses ASP.NET Forms authentication in an MVC fashion. This means that the application includes the AspnetDB database. It also has a SQL Server Express database file named WebAdvert. WebAdvert database contains one table only which is named “Adverts”. Ads are stored in Adverts table. The structure of this table is as bellow:

Figure 1: Structure of Adverts table

Use the following credentials to login:

User name: admin

Password: password)_

 

Figure 2 the browsing page

 

Prerequisites

  • Visual Studio 2010
  • Visual C# Express Edition 2010
  • Visual Web Developer 2010
  • ASP.NET MVC 3
  • Entity Framework 4
  • SQL Server 2008 Express Edition

 

Download

Download WebAdvert ASP.NET MVC 3.0 source code from webadvert.codeplex.com

About these ads

35 thoughts on “ASP.NET MVC 3 Sample Application

  1. xs says:

    Thx, but is there a razor sample?

    btw, I see the image is a path. But when i tried to insert a record with a image upload. The image is not stored in database.

    Any idea?

    • Aref Karimi says:

      Sorry mate I’ve been busy with managing unmanageble stuff! I’m intended to develop a 2nd version of this project with the most recent MVC 3 features.

    • Aref Karimi says:

      Just opening and reading/writing an Excel file has nothing to do with the View so you can do it as you did before (in ASP.NET or other types of apps). I recommend you to use Visual Studio Tools for Office.

  2. karthik says:

    Hi Aref,

    I saw your sample application it was so simple and well structured but still I guess I am lagging the basics to understand these as I am new to this so can u pls suggest me which book to follow before starting an MVC3 application.

    • Aref says:

      Hi Karthik

      I made that simple app last year. I’ve been intended to make another version of it which employs best practices and MVC3 specific features such as Razor but honestly I have not find time to do so. so apologies for it.
      O’Reily has a good ASP.NET MVC3 book which I like. Also there are some sample codes in MSDN (google it to find it) that will help.

  3. karthik says:

    thanks for your kind reply, I just started with your sample as it looks a bit simple and going with O’Reily. Hope this will help me out to get a knowledge in asp.net mvc 3

  4. Shital says:

    hi,
    getting error while running this sample as”Re: System.Data.EntityException :: “The underlying provider failed on Open.”

    can you please help me to resolve for this.

  5. Fantastic website you have here but I was curious about if you knew
    of any community forums that cover the same topics discussed here?
    I’d really love to be a part of group where I can get feedback from other experienced people that share the same interest. If you have any recommendations, please let me know. Thanks a lot!

  6. Aniyan says:

    It working fine but .
    I have some more doubts in this project.. can any one help me.. I am new in mvc..
    1. when i extract the file I got sln file outside the Webart folder.
    2. browse.aspx <a href='Browse?page=’> is getting null .

  7. Rayyan says:

    I’m new into .net and getting below error while running the app. plz help

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 59:
    Line 60:
    Line 61: <a href='Browse?page=’>
    Line 62:
    Line 63: <a href='Browse?page=’><img alt=""

    Source File: e:\Downloads\on-re-po\OnlineAdv\WebAdvert\Views\Adverts\Browse.aspx Line: 6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s