Gaurav Raj

Gaurav Raj

  • 1.4k
  • 475
  • 34.4k

why are return json page instead of view

Sep 18 2018 9:57 AM
if (Session["UserID"]!=null)
{
if (user==id)
{
//var q = (from a in db.RegisterTables
// where a.Id == user
// select a).SingleOrDefault();
//if (q!=null)
//{
// ViewData["name"] = q.F_Name + ' ' + q.L_Name;
// ViewData["UserPic"] = q.Pic;
//}
//return Json(q, JsonRequestBehavior.AllowGet);
db.Configuration.ProxyCreationEnabled = false;
RegisterTable ma = db.RegisterTables.First(x => x.Id == id);

return Json(ma, JsonRequestBehavior.AllowGet);
}
else
{
//var q = (from a in db.RegisterTables
// where a.Id == id
// select a).SingleOrDefault();
//if (q != null)
//{
// ViewData["name"] = q.F_Name + ' ' + q.L_Name;
// ViewData["UserPic"] = q.Pic;
//}
//return Json(q, JsonRequestBehavior.AllowGet);
// db.Configuration.ProxyCreationEnabled = true;
RegisterTable ma = db.RegisterTables.First(x => x.Id == id);
return Json(ma, JsonRequestBehavior.DenyGet);
}

}
else
{
return RedirectToAction("Login", "Account");
}

Answers (2)