Ejemplo n.º 1
0
        public ActionResult Edit(BannerModel model, int id)
        {
            if (ModelState.IsValid)
            {
                string picture = null;
                // file
                if (Request.Files != null &&
                    Request.Files.Count > 0)
                {
                    picture       = FileHelper.SaveBannerImage(Request.Files[0]);
                    model.Picture = picture;
                }

                var banner = jlService.GetBanner(id);
                banner.BackgroundColor = model.BackgroundColor;
                banner.Desctiption     = model.Desctiption;
                banner.Picture         = model.Picture;
                banner.SortIndex       = model.SortIndex;
                banner.Status          = model.Status;
                banner.Title           = model.Title;

                jlService.UpdateBanner(banner);

                ViewData.Add("ResultObject", ResultObject.Succeed());
            }

            return(View(model));
        }