Пример #1
0
        public IActionResult Create([FromForm] PublisherViewModel publisher)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var publisherModel = _mapper.Map <Publisher>(publisher);

            _publisherService.CreatePublisher(publisherModel);
            var publisherOrigin = _publisherService.GetPublisherByCompany(publisher.CompanyName);

            _publisherService.AddPublisherTranslate(publisher.CompanyNameRu, publisher.DescriptionRu, publisher.HomePageRu, "ru", publisherOrigin.Id);

            return(StatusCode(StatusCodes.Status201Created));
        }