I am working on mvc c# , with sql database at backend. My problem is when I update a table's data manually from sql table at backend. It is not updated on the frontend until I open the website again after closing the webpage.
Here is the Image of database table where am updating it manually.
here am retrieving data from database.
public ActionResult AddQuiz()
{
ViewBag.quizes_List = db.EntityFrameWorkConnection.Zasa_Quiz.OrderByDescending(mm => mm.quiz_code).ToList();
return View();
}
This is where am using my ViewBag to display quizes list
@foreach (var item in @ViewBag.quizes_List)
{
<tr>
<td>
<span class="badge bg-blue">@item.quiz_code</span>
</td>
<td>
@item.quiz_title
</td>
<td><span class="badge bg-blue">@item.quiz_date.ToString().Substring(0, 10)</span></td>
</tr>
}
EntityFrameWorkConnection is in constants class. and db is declared like this in controller: and all this is working fine.
private static Constants db = new Constants();
public class Constants
{
public ZASA_AK_DBEntity EntityFrameWorkConnection = new ZASA_AK_DBEntity();
public SqlConnection ADOConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["adocon"].ConnectionString);
public string ConnectionString = ConfigurationManager.ConnectionStrings["adocon"].ConnectionString;
}