Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need Help in MVC web Api

Posted on 2014-04-23
6
Medium Priority
?
469 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
[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
  • 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 2000 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

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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