mardi 28 juin 2016

how can pass more than one query object to a view

i have an action named PackageIndex in which i am creating a list type view of package class ..in this view i use layout in which i have to to display notification on navbar ...for that purpose i have to pass notification list to layout to display notification..my code is given below...

  public ActionResult PackageIndex()
        {
            //feedback counter
            int count = feedbackCounter();
            ViewData["FeedbackCount"] = count;
            int notificationcount = notificationCounter();
            ViewData["notificationcount"] = notificationcount;
            return View(db.packages.ToList());
        }

in this action i also have to passs (db.notification.ToList())...to provide data to layout ..i can't understand how to solve this...

Aucun commentaire:

Enregistrer un commentaire