示例#1
0
        public JsonResult Create(BannerDto model)
        {
            string errs = GetModelStateError();

            if (!string.IsNullOrEmpty(errs))
            {
                return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs)));
            }
            bool IsSucceed = _BannerAppService.Create(new BannerDto()
            {
                ID               = Guid.NewGuid(),
                CreateTime       = DateTime.Now,
                CreatorID        = _currUser.ID,
                Image            = model.Image,
                LanguageTypeID   = model.LanguageTypeID,
                LastUpdateTime   = DateTime.Now,
                LastUpdateUserID = _currUser.ID,
                SerialNumber     = model.SerialNumber,
                Title            = model.Title,
                Url              = model.Url,
            });

            if (IsSucceed)
            {
                return(Json(new OperateMessage <string>("/Banner/Index")));
            }
            return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "添加成功!" : "添加失败!")));
        }