public ActionResult Edit(long id)
        {
            BannerSaveModel model = new BannerSaveModel();

            model.Banner = objBanner.GetBannerByID(id);
            return(View(model));
        }
        //[AntiXSRFFilter]
        public ActionResult Edit(BannerSaveModel model, string sessionXSRFToken)
        {
            utblBanner banner = new utblBanner();

            banner = objBanner.GetBannerByID(model.Banner.BannerID);
            string PrvPath = banner.BannerPath;

            if (ModelState.IsValid)
            {
                string name = "";
                if (model.PhotoStrs.PhotoNormal != null)
                {
                    //if (!IsBase64(model.PhotoStrs.PhotoNormal))
                    //{
                    //    ModelState.AddModelError("PhotoStrs.PhotoNormal", "Invalid Photo");
                    //    return View(model);
                    //}
                    Random rand = new Random();
                    name = "Banner_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                    string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                    if (normal_result.Contains("Error"))
                    {
                        TempData["ErrMsg"] = normal_result;
                        return(View(model));
                    }
                    else
                    {
                        DeleteFile(PrvPath);
                    }
                    model.Banner.BannerPath  = "/Uploads/Banner/" + normal_result;
                    model.Banner.BannerThumb = model.PhotoStrs.PhotoThumb;
                }
                model.Banner.TransDate = DateTime.Now;
                model.Banner.UserID    = User.Identity.Name;
                //model.Banner.IPAddress = IPAddressGetter.GetIPAddress();

                string result = objBanner.SaveBanner(model.Banner);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblBanners", "Banner Updated", IPAddressGetter.GetIPAddress(), User.Identity.Name, model.Banner.BannerID);

                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "banner", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                DeleteFile(name);
            }
            return(View(model));
        }
        //[AntiXSRFFilter]
        public ActionResult Add(BannerSaveModel model, string sessionXSRFToken)
        {
            var validData = true;

            if (model.PhotoStrs.PhotoNormal == null)
            {
                ModelState.AddModelError("PhotoStrs.PhotoNormal", "Select a Photo");
                validData = false;
            }
            //else if (!IsBase64(model.PhotoStrs.PhotoNormal))
            //{
            //    ModelState.AddModelError("PhotoStrs.PhotoNormal", "Invalid Photo");
            //    validData = false;
            //}
            if (ModelState.IsValid && validData)
            {
                Random rand          = new Random();
                string name          = "Banner_" + DateTime.Now.ToString("yyyyMMdd") + "_" + rand.Next(50) + ".jpg";
                string normal_result = SaveImage(model.PhotoStrs.PhotoNormal, name);
                if (normal_result.Contains("Error"))
                {
                    TempData["ErrMsg"] = normal_result;
                    return(View(model));
                }
                model.Banner.BannerPath  = "/Uploads/Banner/" + normal_result;
                model.Banner.TransDate   = DateTime.Now;
                model.Banner.UserID      = User.Identity.Name;
                model.Banner.BannerThumb = model.PhotoStrs.PhotoThumb;
                string result = objBanner.SaveBanner(model.Banner);
                if (result.Contains("Success"))
                {
                    objSite.AddAuditLog("utblBanners", "New Banner Added", IPAddressGetter.GetIPAddress(), User.Identity.Name);
                    TempData["ErrMsg"] = result;
                    return(RedirectToAction("index", "banner", new { Area = "Admin" }));
                }
                TempData["ErrMsg"] = result;
                DeleteFile(name);
            }
            return(View(model));
        }