Пример #1
0
        public ResponseViewModel Add(PictureGroupDto pictureGroupDto)
        {
            var response = new ResponseViewModel();

            if (pictureGroupDto.CreatedBy != null)
            {
                var createdBy = IsUserHave((int)pictureGroupDto.CreatedBy);
                if (!createdBy)
                {
                    response.IsSuccess = false;
                    response.Message   = "createdBy User tablosunda bulunamadı ";

                    return(response);
                }
            }

            var pictureGroup = new PictureGroup()
            {
                PictureImage = pictureGroupDto.PictureImage,
                CreateDate   = DateTime.Now,
                CreatedBy    = pictureGroupDto.CreatedBy,
            };

            _pictureGroupDal.Add(pictureGroup);
            var saving = _pictureGroupDal.SaveChanges();

            if (!saving)
            {
                response.IsSuccess = false;
                response.Message   = "PictureGroup kaydedilirken bir hata oluştu";
                response.Data      = pictureGroup;
            }

            response.Data = "Id : " + pictureGroup.Id;

            return(response);
        }
Пример #2
0
 public IResult Add(PictureGroup pictureGroup)
 {
     _pictureGroupDal.Add(pictureGroup);
     return(new SuccessResult(Messages.Added));
 }