Solved

Developing an ASP.net  MVC solution

Posted on 2013-11-11
3
639 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
  • 2
3 Comments
 
LVL 9

Expert Comment

by:sevensnake77
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:
sevensnake77 earned 500 total points
ID: 39646416
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now