Exemplo n.º 1
0
 public CreateProductRequestToProductMapper(ICreatePropertyRequestToPropertyMapper propertyMapper,
                                            ICreateLaunchRequestToLaunchMapper launchMapper,
                                            ICreatePriceRequestToPriceMapper priceMapper)
 {
     _propertyMapper = propertyMapper;
     _launchMapper   = launchMapper;
     _priceMapper    = priceMapper;
 }
Exemplo n.º 2
0
        public async Task <IActionResult> AddOrUpdatePropertyAsync(string key, [FromBody] CreatePropertyRequest request, [FromServices] ICreatePropertyRequestToPropertyMapper mapper)
        {
            if (ModelState.IsValid)
            {
                var property = mapper.Map(request);

                await _service.AddOrUpdateProductPropertyAsync(property, key);

                var link = _urlHelper.Link(GetPropertiesByProductRouteName, new { controller = "properties", key = key });

                return(Created(link, link));
            }

            return(BadRequest());
        }