示例#1
0
        public ActionResult Add(BannerViewModel banner)
        {
            var app  = new ServiceReference.ContractClient();
            var path = string.Empty;

            if (Request.Files.Count == 1)
            {
                path = ImageHelper.SaveImage("Banner", Request.Files[0], Server.MapPath("~/Image"));
            }
            var model = new ServiceReference.Banner
            {
                Id          = banner.Id,
                ImageUrl    = path,
                Description = banner.Description,
                Title       = banner.Title,
                Url         = banner.Url,
            };

            app.AddBanner(model);

            return(RedirectToAction("GetAll"));
        }