// GET: api/Cliente/5 public GenericResponse <ClienteDto> Get(int id) { GenericResponse <ClienteDto> response = new GenericResponse <ClienteDto>(); try { response.Data = servicio.BuscarPorId(id); if (response.Data == null) { throw new CustomResponseException("No se encontró al cliente", 404); } response.Error = false; response.Mensaje = "Ok"; response.Codigo = 200; } catch (CustomResponseException ex) { throw ex; } catch (Exception ex) { throw new CustomResponseException(ex.Message, 500); } return(response); }