Exemplo n.º 1
0
        public CDataResult <int> Add(CPictureInput input)
        {
            var query = this._pictureRepository.GetAll().Where(r => r.Title == input.Title);

            if (query.Count() > 0)
            {
                return(new CDataResult <int>()
                {
                    IsSuccess = false,
                    ErrorMessage = "图片名称已存在!",
                    Data = 0
                });
            }
            var newPicture = new CPicture()
            {
                Title        = input.Title,
                ImgUrl       = input.ImgUrl,
                DisplayIndex = input.DisplayIndex,
                CompanyId    = input.CompanyId
            };

            var newPictureId = this._pictureRepository.InsertAndGetId(newPicture);

            return(new CDataResult <int>()
            {
                IsSuccess = true,
                ErrorMessage = null,
                Data = newPictureId
            });
        }
Exemplo n.º 2
0
 public CDrawing()
 {
     cdb   = new CDB();
     cpict = new CPicture();
 }