Пример #1
0
        public IHttpActionResult InsertSpecification(InsertSpecificationRequestDto requestDto)
        {
            Specification specificationType = _specificationMapper.ToSpecification(requestDto);

            specificationType.Id = _specificationService.InsertSpecification(specificationType);
            return(Created($"specification/{specificationType.Id}",
                           _specificationMapper.ToDto(specificationType)));
        }
Пример #2
0
        public IHttpActionResult InsertCar(InsertCarRequestDto carRequestDto)
        {
            List <Specification> specifications = new List <Specification>();

            foreach (var insertSpecificationRequestDto in carRequestDto.Specifications)
            {
                specifications.Add(_specificationMapper.ToSpecification(insertSpecificationRequestDto));
            }

            Product insertCar = _carService.InsertCar(_carsMapper.ToProduct(carRequestDto), specifications);

            return(Created($"car/{insertCar.Id}", _carsMapper.ToDto(insertCar)));
        }