Beispiel #1
0
 /// <summary>
 /// Hien thi chi tiet tin tuc
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult DetailNews(Guid id)
 {
     try
     {
         if (id != null)
         {
             RepositoryOBTRS db   = new RepositoryOBTRS();
             List <tbl_New>  news = db.GetNewsListByID(id);
             ViewData["Title"]   = news[0].News_Title;
             ViewData["Content"] = news[0].News_Content;
         }
         else
         {
             ViewData["Title"]   = "";
             ViewData["Content"] = "";
         }
     }
     catch (Exception)
     {
         Response.Write("<strong style='font-size:12pt'>Have a error in during request to server!</strong>");
         Response.Write("<br>Sorry for this inconvenience! Please<a href='/Home'> click here</a> to HOME PAGE.");
         //throw;
         return(null);
     }
     return(View());
 }
 public ActionResult EditNews(Guid id)
 {
     if (Session["Role"].ToString() == "N" || Session["Role"].ToString() == "R")
     {
         Response.Write("Access denied!");
         return(null);
     }
     else
     {
         RepositoryOBTRS repData = new RepositoryOBTRS();
         ViewData["NewsID"] = id;
         List <tbl_New> news = repData.GetNewsListByID(id);
         ViewData["Title"]  = news[0].News_Title;
         ViewData["Data"]   = news[0].News_Content;
         ViewData["Active"] = news[0].News_Active;
         return(View());
     }
 }