public ActionResult ShowDetails(string id) { string decryptedID = ParameterEncryption.Decrypt(HttpUtility.UrlDecode(id)); int decryptedIDInt = 0; if (int.TryParse(decryptedID, out decryptedIDInt) == false) { return(Content("<h2 style='text-align:center;color:red; margin-top:20%'>An Error Occoured While Log In</h2>")); } DBContext DB = new DBContext(); Information info = DB.Information.Where(x => x.Id == decryptedIDInt).FirstOrDefault(); return(View(info)); }
// GET: ViewData public ActionResult Show(string id) { string decryptedID = ParameterEncryption.Decrypt(HttpUtility.UrlDecode(id)); int decryptedIDInt = 0; //return Content("<h2 style='text-align:center;color:red; margin-top:20%'>An Error Occoured While Processing</h2>" + decryptedID); if (int.TryParse(decryptedID, out decryptedIDInt) == false) { return(Content("<h2 style='text-align:center;color:red; margin-top:20%'>An Error Occoured While Processing</h2>")); } DBContext DB = new DBContext(); Information info = null; info = DB.Information.Where(x => x.Id == decryptedIDInt).FirstOrDefault(); ViewBag.imageSource = "http://salahuddinahmedhighschool.com/student_images/" + decryptedIDInt + ".jpg"; return(View("Show", info)); }