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 }); }
public CDrawing() { cdb = new CDB(); cpict = new CPicture(); }