예제 #1
0
        public async Task <IActionResult> Create([FromForm] CreateShapeInput input)
        {
            var absolutePath = Path.Combine(_webHostEnvironment.WebRootPath, Shape.IMAGE_PATH);

            await _shapeService.Create(input, absolutePath);

            return(Ok());
        }
예제 #2
0
        public async Task Create(CreateShapeInput input, string imageFolderPath)
        {
            var imageName = await Upload.UploadImageAsync(input.Image, imageFolderPath);

            var shape = new Shape(image: imageName,
                                  name: input.Name,
                                  status: input.Status,
                                  description: input.Description);
            await _shapeRepo.Create(shape);

            await _shapeRepo.SaveChangesAsync();
        }