Solved

Developing an ASP.net  MVC solution

Posted on 2013-11-11
3
648 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: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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Form Data Disappears Using Back Button 4 69
Create a Dropdown list with sub group 10 43
asp.net mvc5 6 34
MVC5 ViewModel View cannot resolve names 2 16
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

759 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