public ActionResult AddOrEditBanner(Guid?id, BannerViewModel model, HttpPostedFileBase image)
        {
            try
            {
                bool   isNew     = !id.HasValue;
                string localFile = "~/Content/img/banner";

                // isNew = true update UpdatedDate of product
                // isNew = false get it by id
                var banner = isNew ? new Banner
                {
                    UpdatedDate = DateTime.Now
                } : _bannerService.GetById(id.Value);
                banner.Image    = _bannerService.UpFile(image, localFile);
                banner.Link     = model.Link;
                banner.IsActive = true;
                banner.AdType   = model.bannerType;
                if (isNew)
                {
                    // chage status = false for all Product Advertisement Type same type
                    var a = _bannerService.GetAllBannerSameType(model.bannerType);
                    if (a.Count() > 0)
                    {
                        foreach (var proVa in a)
                        {
                            _bannerService.ChangeStatus(proVa, false);
                        }
                    }
                    banner.CreatedDate = DateTime.Now;
                    banner.Id          = Guid.NewGuid();
                    _bannerService.Insert(banner);
                }
                else
                {
                    _bannerService.Update(banner);
                }
                return(RedirectToAction("Index"));
            }
            catch { return(RedirectToAction("Erorr500", "HomdeAdmin")); }
        }