Esempio n. 1
0
        public async Task <IActionResult> SaveClientAsync([FromBody] ClientDto clientDto)
        {
            try
            {
                var client   = clientDto.ToModel();
                var response = await _applicationService.SaveAsync(client);

                var webResponse = new SaveWebResponse <ClientDto>()
                                  .From(response);

                if (webResponse.IsSuccessful)
                {
                    return(Ok(webResponse));
                }

                return(BadRequest(webResponse.Errors));
            }
            catch (Exception ex)
            {
                var message = "Unable to save the client";
                Console.WriteLine(ex);
                _logManager.LogError(ex, message);
                return(BadRequest(message));
            }
        }