I am not sure how to get my SQL view to actually be read from the .cshtml
file. I have my model created to relate to the view and have added the DbSet to the appdbcontext class. I have also done the keyless on the onModelBuilder and created this
public async Task<IActionResult> PreviewEmailAsync()
{
var myTableResults = _context.WetWeatherReportViews.FromSqlRaw(
"Select * from dbo.WetWeatherReportView").ToList();
ViewBag.Data = myTableResults;
return View();
}
Not sure how to get the view to showcase the information within, I have tried multiple different methods and believe the ViewBag
is my closest one, but don't believe I am doing it right. I am unable to get it to work and not sure what I am missing. Thank you for the help!