//[Authorize] public async Task <IActionResult> AddClient(ClientBindingDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { if (await _repo.ClientExist(dto.ClientName)) { ClientErrorResponseDto response = new ClientErrorResponseDto { Error = "Conflict", Message = "A Client with name '" + dto.ClientName + "' already exist" }; return(Conflict(response)); } return(Ok(await _repo.AddClient(_factory.CreateClientEntity(dto), dto))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
//[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(Dto.Responses.ErrorResponse))] public async Task <IActionResult> AddClient(ClientBindingDto dto) { return(Ok(await _repo.AddClient(_factory.CreateClientEntity(dto), dto))); }