//public ActionResult _Create([DataSourceRequest]DataSourceRequest request, TB_LatestNewsExt model)
        //{
        //    string Msg = "";
        //    try
        //    {
        //        TB_LatestNewsRepository modelRepo = new TB_LatestNewsRepository();
        //        if (modelRepo.Create(model, ref Msg, this) == false)
        //        {
        //            return this.Json(new DataSourceResult { Errors = Msg });
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        string error = ErrorHandling.HandleException(ex);
        //        return this.Json(new DataSourceResult { Errors = error });
        //    }
        //    return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        //}
        public ActionResult _Destroy([DataSourceRequest]DataSourceRequest request, TB_LatestNewsExt model)
        {
            string Msg = "";
            try
            {
                TB_LatestNewsRepository modelRepo = new TB_LatestNewsRepository();
                if (modelRepo.Delete(model, ref Msg, this) == false)
                {
                    return this.Json(new DataSourceResult { Errors = Msg });
                }
            }
            catch (Exception ex)
            {
                string hostName1 = Dns.GetHostName();
                string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                string PageName = Convert.ToString(Session["PageName"]);
                //string GetUserIPAddress = GetUserIPAddress1();
                using (BaseRepository baseRepo = new BaseRepository())
                {
                    //BizContext BizContext1 = new BizContext();
                    BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                }
                Session["PageName"] = "";
                string error = ErrorHandling.HandleException(ex);
                return this.Json(new DataSourceResult { Errors = error });
            }

            return Json(request);
        }
 public ActionResult Edit(int id)
 {
     Session["PostImage"] = "";
     //EmailExt model = new EmailExt();
     TB_LatestNewsRepository modelRepo = new TB_LatestNewsRepository();
     TB_LatestNewsExt model = modelRepo.GetLatestNewsByID(id);
     Session["PostImage"] = model.PostImage;
     // ViewBag.EmailTemplates = DropDownLists.GetListEmailTemplates(model.MailTemplateID);
     AssignBizContext();
     SecurityUtils.SetGlobalViewbags(this, ActiveMenu, BizContext.UserContext.IsAdmin(), BizContext.UserContext.IsHotelAdmin(), BizContext.HotelID);
     return View(model);
 }
        public ActionResult InsertLatestNews(HttpPostedFileBase txtPostImage, string UserID, string Title_tr, string Title_en, string Title_de, string Title_fr, string Title_ru,
            string Title_ar, string Description_tr, string Description_en, string Description_de, string Description_fr, string Description_ru, string Description_ar, string Active)
        {
            //Session["RegisteredStatus"] = "";
                //Session["VisitorCount"] = "";
                string ContentfileName = "";
                string filenames = "";
                TB_LatestNewsRepository inserthome = new TB_LatestNewsRepository();
                string path = "";
                string date = DateTime.Now.ToString("yyyyMMddHHmmss");
            int UserId=0;
                try
                {
                    if (txtPostImage != null)
                    {
                        var UploadPath = "~/Upload/LatestNews/";
                        UploadPath = Server.MapPath(UploadPath);
                        CreateDirectory(UploadPath);
                        ContentfileName = Path.GetFileName(UserID + date + txtPostImage.FileName);
                        path = Path.Combine(UploadPath,ContentfileName);
                        try
                        {
                            txtPostImage.SaveAs(path);
                        }
                        catch
                        {

                        }
                        filenames = Convert.ToString(ContentfileName);

                    }

                    UserId = inserthome.InsertLatestNews(UserID, Title_tr, Title_en, Title_de, Title_fr, Title_ru, Title_ar, Description_tr, Description_en, Description_de,
                        Description_fr, Description_ru, Description_ar, Active, ContentfileName);

                }
                catch (Exception ex)
                {
                    string hostName1 = Dns.GetHostName();
                    string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                    string PageName = Convert.ToString(Session["PageName"]);
                    //string GetUserIPAddress = GetUserIPAddress1();
                    using (BaseRepository baseRepo = new BaseRepository())
                    {
                        //BizContext BizContext1 = new BizContext();
                        BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                    }
                    Session["PageName"] = "";
                    string error = ErrorHandling.HandleException(ex);
                    return this.Json(new DataSourceResult { Errors = error });
                }
            //Session["VisitorCount"] = "1";
             return Json(UserId, JsonRequestBehavior.AllowGet);
        }
        public ActionResult _Read([DataSourceRequest]DataSourceRequest request, int TableID)
        {
            DataSourceResult result = null;
            try
            {
                TB_LatestNewsRepository modelRepo = new TB_LatestNewsRepository();
                 result = modelRepo.ReadAll(TableID).ToDataSourceResult(request);
            }
            catch (Exception ex)
            {
                string hostName1 = Dns.GetHostName();
                string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                string PageName = Convert.ToString(Session["PageName"]);
                //string GetUserIPAddress = GetUserIPAddress1();
                using (BaseRepository baseRepo = new BaseRepository())
                {
                    //BizContext BizContext1 = new BizContext();
                    BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                }
                Session["PageName"] = "";
                string error = ErrorHandling.HandleException(ex);
                return this.Json(new DataSourceResult { Errors = error });
            }

            return Json(result);
        }