I have model and viewBag in the same action method. in my case i can get the model data's in the view but ViewBag is not showing in the view
public IActionResult Projects()
{
var info = db.test
.Where(x => x.Id == y.Id)
.OrderByDescending(x => x.Project)
.ToList();
var count = db.test
.Where(x => x.Id == test.Id)
.Select(x => x.amount)
.Sum();
ViewBag.count = count ;
return View(info);
}
view:-
@model IEnumerable<website.Models.Project>
@{
ViewData["Title"] = "Project";
}
<div class="card-header p-1">
<h4 class="card-title ">Project
<span class="blue-grey lighten-2 font-small-3">@ViewBag.count</span>
</h4>
<span class="badge">Approved</span> </div>