Search code examples
asp.net-mvcasp.net-mvc-3billing

How do I make an MVC Billing page?


I've made a music store using the tutorials on ASP.net and they do not show you how to make a billing page. What I would like to know is would I have to make a new controller and view for it or will I just need a view and to add a piece of code to an existing controller? Also, how can I make the page so that it authorizes the details given, for example, will know when the card details are not correct like the wrong security code or wrong card number in general?

Much appreciated


Solution

  • So you need to continue to tutorials on asp.net mvc site you should try the tutorial on models page code first with entity framework there are so many samples about validation.

    For the credicard validation there is an algorythym of this named Luhn Formula, so really you don't have to know how to validate, there is a asp.net code that has been written and works on the link also you can use javascript validators on view to give better service.

    http://www.codeproject.com/KB/aspnet/wdxcreditcardvalidation.aspx

    you just need to write a code on controller (it just to show you how it's done, you may need to write additional codes)

    if(luhnisvalid(Order.billingdetails.CreditCard))
    {
      // then adding to database
    }
    

    or return to view

    return(View(Order));
    

    and finally continue to this tutorial it will give you so much information, after the tutorial i'm sure that you can make the billing part.

    http://www.asp.net/entity-framework/tutorials/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application