コード例 #1
0
        /// <summary>
        /// 添加头部信息
        /// </summary>
        /// <param name="bannerModel">Banner</param>
        /// <returns>响应实体模型</returns>
        public ResponseModel AddBanner(BannerModel bannerModel)
        {
            Banner banner = new Banner();

            try
            {
                banner.Id      = bannerModel.Id;
                banner.Image   = bannerModel.Image;
                banner.Remark  = bannerModel.Remark;
                banner.Url     = bannerModel.Url;
                banner.AddTime = DateTime.Now;
            }
            catch { return(new ResponseModel {
                    code = 0, message = "内部添加错误,请重试"
                }); }
            bool add = bannerRepository.AddEntity(banner);

            if (add == false)
            {
                return new ResponseModel {
                           code = 0, message = "添加失败"
                }
            }
            ;
            return(new ResponseModel {
                code = 200, message = "添加成功"
            });
        }