public IActionResult CreateCustomerType([FromBody] CustomerTypeForCreationDto payload) { if (!ModelState.IsValid) { return(BadRequest()); } if (payload.Label == payload.Description) { ModelState.AddModelError("Description", "Label must be different from description."); } var finalCustomerType = _mapper.Map <CustomerType>(payload); var createdCustomerType = _customerTypeService.CreateCustomerType(finalCustomerType); return(CreatedAtRoute( "GetCustomerTypeById", new { id = createdCustomerType.Id }, _mapper.Map <CustomerTypeDto>(createdCustomerType))); }