コード例 #1
0
ファイル: BannerController.cs プロジェクト: cykevin/jl.web
        public ActionResult New(BannerModel model)
        {
            if (ModelState.IsValid)
            {
                // file
                if (Request.Files != null &&
                    Request.Files.Count > 0 &&
                    Request.Files[0].ContentLength > 0)
                {
                    var picture = FileHelper.SaveBannerImage(Request.Files[0]);
                    model.Picture = picture;
                }

                var banner = new Banner();
                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.AddBanner(banner);

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

            return(View());
        }