0

I am storing an object from a list to a local variable and trying to pass it to a view like below:

 public class BedController : Controller
{
    // GET: Bed
    public ActionResult Index(PatientRegister model, int id)
    {
        var patient = PatientRegisterController.BedsList.Single(x => x.NewPatient.BedNumber.Equals(id.ToString()));
        return View(patient);
    }
}

But I don't know how to access this object from the view itself something like

patient.SelectSomeOfTheProperites //This is the object that I parsed from controller 
0

1 Answer 1

2

Add return object type as model

@model Bed

Access the return object property as

@model.SelectSomeOfTheProperites

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

So @Model is replacing patient object in this case?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.