[Solved]How to return a list to view after foreach in c#
I have this code where I am iterating over objects using foreach loop
public ActionResult userDocs()
{
var user = Server.HtmlEncode(Request.Cookies["UserName"].Value);
var role = db.userdetails.FirstOrDefault(s => s.UserName == user).FullName;
var test = "kokulchellamuthu1programmer";
var find = db.ApplySchedule.Where(x => x.CC.Contains(test)).ToList();
foreach(var i in find)
{
var res = db.docinfo.Where(z => z.RequestID == i.BookingID).ToList();
}
return View(res);
}
Now I want to return the res variable to view in order to display matching downloadable documents to the user, I am unable to return it to the view as the code doesn't compile, can someone please help me with this?
Thanks.
from Recent Questions - Stack Overflow https://ift.tt/3vHk6nj
https://ift.tt/eA8V8J
Comments
Post a Comment