Solved

Need Help in MVC web Api

Posted on 2014-04-23
6
432 Views
Last Modified: 2014-05-15
Hi ,

I am using MVC 6.0 and new to it . I have generated MVC Controler with EF 5 DBContext generator.

My Index Action is

 public ActionResult Index()
        {
            var patient_care = db.Patient_Care.Include(p => p.Person).Include(p => p.Referal);
           
            return View(patient_care.ToList());
        }

Now I want to pass parameter and return the view

Public ActionResult IndexStatus(string status)
{


}

Status a field in Patient table and it should return the type of patient as per parameter passed to index.
0
Comment
Question by:Vikash p
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40018752
What do you mean by, "...and return the view?" Web API generally doesn't deal with views, though it can return HTML as data.
0
 

Author Comment

by:Vikash p
ID: 40018770
Can you just solve the problem .. and return View(patient_care.ToList());
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40018942
I'm afraid I'm confused, and I'm hoping you can clarify how your project is set up. Do you have an MVC project or a Web API project?
0
 

Author Comment

by:Vikash p
ID: 40019026
its a MVC 6 project and i have generated Controlers with EF 5 code builder . i am more a database guy . now they need web api . I need to add something like where clause to
            var patient_care = db.Patient_Care.Include(p => p.Person).Include(p => p.Referal);

we need to pass status as parameter and it should return records with that type of status.
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
ID: 40029334
Why you need a web api. Create a new action link , which is clicked pass the status to the controller.

Now you can use the same dbcontext, to use the parameter .
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Open a link in vb.net 2 16
Why use this lambda? 12 39
why JSON Array data not binding on Model ASP.NET ? 1 14
itextsharp with c# 3 10
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 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