Exemplo n.º 1
0
        public JsonResult AddHandSlideAd(string pic, string url)
        {
            var slide = new Entities.HandSlideAdInfo()
            {
                ImageUrl = pic, Url = url, DisplaySequence = 0
            };

            if (!string.IsNullOrWhiteSpace(pic))
            {
                if (pic.Contains("/temp/"))
                {
                    string source = pic.Substring(pic.LastIndexOf("/temp"));
                    string dest   = @"/Storage/Plat/ImageAd/";
                    pic = Path.Combine(dest, Path.GetFileName(source));
                    Core.MallIO.CopyFile(source, pic, true);
                }
                else if (pic.Contains("/Storage/"))
                {
                    pic = pic.Substring(pic.LastIndexOf("/Storage/"));
                }

                slide.ImageUrl = pic;
            }
            _iSlideAdsService.AddHandSlidAd(slide);
            return(Json(new Result {
                success = true
            }));
        }