コード例 #1
0
        public JsonResult EditHandSlideAd(long id, string pic, string url)
        {
            var slide = _iSlideAdsService.GetHandSlidAd(id);

            if (!string.IsNullOrWhiteSpace(pic) && (!slide.ImageUrl.Equals(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/"));
                }
            }

            _iSlideAdsService.UpdateHandSlidAd(new Entities.HandSlideAdInfo
            {
                Id       = id,
                ImageUrl = pic,
                Url      = url
            });
            return(Json(new Result {
                success = true
            }));
        }