예제 #1
0
        public ServiceResult Create(ProductGalleryImageDTO model)
        {
            var entity = new ProductGalleryImage();

            Mapper.Map(model, entity);

            _ProductGalleryImage.Add(entity);
            _Context.SaveChanges();

            return(ServiceResult.Okay());
        }
        public IActionResult Create(ProductGalleryImageDTO model, IFormFile Image)
        {
            var imageName = FileHelper.SaveFile(Image, _fileConfig, FileType.Image, _environment.WebRootPath);

            if (imageName != null)
            {
                model.Image = imageName;
            }
            var result = _productGalleryImageRepository.Create(model);

            TempData.AddResult(result);
            return(RedirectToAction(nameof(Index), new { model.ProductId }));
        }