Пример #1
0
        public async Task <IActionResult> Add([FromBody] AssetSettings settings)
        {
            settings = Mapper.Map <AssetSettings>(await _assetSettingsService.AddAsync(settings));

            return(Created
                   (
                       uri: $"api/v2/asset-settings/{settings.Asset}",
                       value: settings
                   ));
        }
        public async Task AddAsync([FromBody] AssetSettingsModel settingsModel)
        {
            try
            {
                var asset = Mapper.Map <AssetSettings>(settingsModel);

                await _assetSettingsService.AddAsync(asset);
            }
            catch (EntityAlreadyExistsException)
            {
                throw new ValidationApiException(HttpStatusCode.Conflict, "Asset settings already exist.");
            }
        }