Solved

Developing an ASP.net  MVC solution

Posted on 2013-11-11
3
651 Views
Last Modified: 2013-11-22
I am pretty new to developing application in MVC. I am primarily a VB developer and trying to learn C#.

Here is what I already have completed.

I have a website with strongly typed datasets that are used to fetch data from the backend SQL db.

Now I want to create JSON responses to some of my functions. I heard the way to go is MVC.

Can anyone show me a way out with some sample. I can provide the connection string to my  SQL db.

for eg. I have a member registration table in my database. I have 2 methods namely retrieveMemberList and retrieveMemberDetails(iMemberID)

Now I want to create a JSON response that would provide the data of the members when we pass the memberid.

the url is http://localhost/demo.svc/retrieveMemberDetails?id=1

the output needs to be {"<method_name>":[{"MEMBER_ID":"123","MEMBER_FULL_NAME":"Sam"}]}

Thank in advance for your help.
0
Comment
Question by:DevLearner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:Seven price
ID: 39640736
You can do this 2 ways either with a stored procedure or a model of your entities.
Add a model to your database. The DBcontext will be created automatically.

You can call the model within your controller.
 public ActionResult GetDataForInvoiceNumber(DisputeKeyData disputeKeyData)  
  {  
     //Blah!  
     //....  
     return Json(disputeKeyData, JsonRequestBehavior.AllowGet);  
  }  

Open in new window

the return Json you can use firebug to see if you are recieving the data or not. Once you see you have receive it you can then use json jquery to pass it to the view.
0
 

Author Comment

by:DevLearner
ID: 39642747
I do have strongly typed dataset that were originial used for the ASP.net website. Inorder for me to directly access the SQL stored procedures how do i do so. ANy code snippet or any tutorial that describes the same.

Can you also elaborate on the "Add a model to your database" and how the DBContent is created.

A very simple code project may help me to follow through. Greatly appreciate your responses sir.
0
 
LVL 9

Accepted Solution

by:
Seven price earned 500 total points
ID: 39646416
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question