public async Task <IActionResult> Create(string clientId, [FromBody] ClientProfileCreateDto form)
        {
            await _clientProfileService.Create(clientId, form);

            string uri = Url.Action(nameof(Get), new { clientId });

            return(Created(uri, null));
        }
示例#2
0
        public async Task Create(string clientId, ClientProfileCreateDto dto)
        {
            EnsureModelValid(dto);

            ClientProfile existProfile = await FindByClientId(clientId, tracking : true);

            if (existProfile != null)
            {
                throw new BadRequestException($"ClientProfile with ClientId '{clientId}' already exist.");
            }

            ClientProfile profile = new ClientProfile
            {
                ClientId        = clientId,
                FaviconLocalUrl = dto.FaviconLocalUrl,
                FaviconUrl      = dto.FaviconUrl
            };

            _clientRepository.Add(profile);
            await _clientRepository.SaveChangesAsync();
        }