Ejemplo n.º 1
0
        public async Task <User> GetUserByIdAsync(int id)
        {
            var sql    = @"SELECT user_id, name, surname, position_id, role_id FROM users WHERE user_id = @Id";
            var result = await _mySqlRepository.SelectSingleItemAsync <User>(sql, new { Id = id });

            if (result == null)
            {
                throw new ValueNotFoundException("Value is null");
            }
            return(result);
        }
        public async Task <Client> GetClientByIdAsync(int id)
        {
            var sql    = "SELECT client_id, client_name, client_middleName, client_surname, client_address, client_phoneNumber FROM clients WHERE client_id =@ClientId";
            var result = await _mySqlRepository.SelectSingleItemAsync <Client>(sql, new { ClientId = id });

            if (result == null)
            {
                throw new ValueNotFoundException("Value is null");
            }
            return(result);
        }