Esempio n. 1
0
        public async Task <ActionResult <MapResponse> > PostCreateMapAsync(
            [FromServices] NaheulbookExecutionContext executionContext,
            [ModelBinder(BinderType = typeof(JsonModelBinder), Name = "request")]
            CreateMapRequest request,
            [FromForm(Name = "image")] IFormFile image
            )
        {
            if (!image.ContentType.StartsWith("image/"))
            {
                return(BadRequest());
            }

            var imageStream = image.OpenReadStream();
            var map         = await _mapService.CreateMapAsync(executionContext, request, imageStream);

            return(_mapper.Map <MapResponse>(map));
        }